[CalendarServer-changes] [10691] CalendarServer/trunk/twext/who
source_changes at macosforge.org
source_changes at macosforge.org
Mon Feb 11 15:49:03 PST 2013
Revision: 10691
http://trac.calendarserver.org//changeset/10691
Author: wsanchez at apple.com
Date: 2013-02-11 15:49:03 -0800 (Mon, 11 Feb 2013)
Log Message:
-----------
Exception cleanup
Modified Paths:
--------------
CalendarServer/trunk/twext/who/idirectory.py
CalendarServer/trunk/twext/who/xml.py
Modified: CalendarServer/trunk/twext/who/idirectory.py
===================================================================
--- CalendarServer/trunk/twext/who/idirectory.py 2013-02-11 23:36:29 UTC (rev 10690)
+++ CalendarServer/trunk/twext/who/idirectory.py 2013-02-11 23:49:03 UTC (rev 10691)
@@ -21,15 +21,18 @@
__all__ = [
"DirectoryServiceError",
"DirectoryAvailabilityError",
+ "UnknownRecordTypeError",
"QueryNotSupportedError",
"NoSuchRecordError",
"NotAllowedError",
+
"RecordType",
"FieldName",
"MatchType",
"Operand",
"QueryFlags",
"DirectoryQueryMatchExpression",
+
"IDirectoryService",
"IDirectoryRecord",
]
@@ -45,7 +48,7 @@
# Exceptions
##
-class DirectoryServiceError(RuntimeError):
+class DirectoryServiceError(Exception):
"""
Directory service generic error.
"""
@@ -55,6 +58,14 @@
Directory not available.
"""
+class UnknownRecordTypeError(DirectoryServiceError):
+ """
+ Unknown record type.
+ """
+ def __init__(self, token):
+ DirectoryServiceError.__init__(self, token)
+ self.token = token
+
class QueryNotSupportedError(DirectoryServiceError):
"""
Query not supported.
Modified: CalendarServer/trunk/twext/who/xml.py
===================================================================
--- CalendarServer/trunk/twext/who/xml.py 2013-02-11 23:36:29 UTC (rev 10690)
+++ CalendarServer/trunk/twext/who/xml.py 2013-02-11 23:49:03 UTC (rev 10691)
@@ -35,7 +35,8 @@
from twisted.python.constants import Names, NamedConstant, Values, ValueConstant
from twisted.internet.defer import succeed, fail, inlineCallbacks, returnValue
-from twext.who.idirectory import DirectoryServiceError, NoSuchRecordError
+from twext.who.idirectory import DirectoryServiceError
+from twext.who.idirectory import NoSuchRecordError, UnknownRecordTypeError
from twext.who.idirectory import RecordType, FieldName as BaseFieldName
from twext.who.idirectory import MatchType
from twext.who.idirectory import DirectoryQueryMatchExpression
@@ -46,25 +47,6 @@
##
-# Exceptions
-##
-
-class ParseError(RuntimeError):
- """
- Parse error.
- """
- def __init__(self, token):
- RuntimeError.__init__(self, token)
- self.token = token
-
-class UnknownRecordTypeParseError(ParseError):
- """
- Unknown record type.
- """
-
-
-
-##
# Data type extentions
##
@@ -137,8 +119,6 @@
# Directory Service
##
-noRealmName = object()
-
class DirectoryService(BaseDirectoryService):
"""
XML directory service.
@@ -265,7 +245,7 @@
for recordNode in directoryNode:
try:
records.add(self.parseRecordNode(recordNode, unknownFieldElements))
- except UnknownRecordTypeParseError, e:
+ except UnknownRecordTypeError, e:
unknownRecordTypes.add(e.token)
#
@@ -307,7 +287,7 @@
try:
recordType = self.value.lookupByValue(recordTypeAttribute).recordType
except (ValueError, AttributeError):
- raise UnknownRecordTypeParseError(recordTypeAttribute)
+ raise UnknownRecordTypeError(recordTypeAttribute)
else:
recordType = self.recordType.user
@@ -513,3 +493,6 @@
def groups(self):
return self.service.recordsWithFieldValue(FieldName.memberUIDs, self.uid)
+
+
+noRealmName = object()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130211/378552e6/attachment-0001.html>
More information about the calendarserver-changes
mailing list