[CalendarServer-changes] [10690] CalendarServer/trunk/twext/who
source_changes at macosforge.org
source_changes at macosforge.org
Mon Feb 11 15:36:29 PST 2013
Revision: 10690
http://trac.calendarserver.org//changeset/10690
Author: wsanchez at apple.com
Date: 2013-02-11 15:36:29 -0800 (Mon, 11 Feb 2013)
Log Message:
-----------
Test immutable realm name
Modified Paths:
--------------
CalendarServer/trunk/twext/who/test/test_xml.py
CalendarServer/trunk/twext/who/xml.py
Modified: CalendarServer/trunk/twext/who/test/test_xml.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_xml.py 2013-02-11 23:29:01 UTC (rev 10689)
+++ CalendarServer/trunk/twext/who/test/test_xml.py 2013-02-11 23:36:29 UTC (rev 10690)
@@ -173,6 +173,14 @@
self.assertEquals(repr(service), "<DirectoryService 'xyzzy'>")
+ def realmNameImmutable(self):
+ def setRealmName():
+ service = self._testService()
+ service.realmName = "foo"
+
+ self.assertRaises(AssertionError, setRealmName)
+
+
@inlineCallbacks
def test_recordWithUID(self):
service = self._testService()
Modified: CalendarServer/trunk/twext/who/xml.py
===================================================================
--- CalendarServer/trunk/twext/who/xml.py 2013-02-11 23:29:01 UTC (rev 10689)
+++ CalendarServer/trunk/twext/who/xml.py 2013-02-11 23:36:29 UTC (rev 10690)
@@ -137,6 +137,8 @@
# Directory Service
##
+noRealmName = object()
+
class DirectoryService(BaseDirectoryService):
"""
XML directory service.
@@ -159,7 +161,7 @@
def __init__(self, filePath, refreshInterval=4):
- BaseDirectoryService.__init__(self, realmName=None)
+ BaseDirectoryService.__init__(self, realmName=noRealmName)
self.filePath = filePath
self.refreshInterval = refreshInterval
@@ -187,7 +189,7 @@
@realmName.setter
def realmName(self, value):
- if value is not None:
+ if value is not noRealmName:
raise AssertionError("realmName may not be set directly")
@property
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130211/cde3b3c0/attachment.html>
More information about the calendarserver-changes
mailing list