[CalendarServer-changes] [1386] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 14 14:02:46 PDT 2007
Revision: 1386
http://trac.macosforge.org/projects/calendarserver/changeset/1386
Author: dreid at apple.com
Date: 2007-03-14 14:02:45 -0700 (Wed, 14 Mar 2007)
Log Message:
-----------
Add a setattr so you can do config.Option = 'Value'
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/config.py
CalendarServer/trunk/twistedcaldav/test/test_config.py
Modified: CalendarServer/trunk/twistedcaldav/config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/config.py 2007-03-14 20:45:04 UTC (rev 1385)
+++ CalendarServer/trunk/twistedcaldav/config.py 2007-03-14 21:02:45 UTC (rev 1386)
@@ -82,9 +82,16 @@
# Authentication
#
"Authentication": {
- "Basic" : { "Enabled": False }, # Clear text; best avoided
- "Digest" : { "Enabled": True, "Algorithm": "md5" }, # Digest challenge/response
- "Kerberos": { "Enabled": False, "Realm": "" }, # Kerberos/SPNEGO
+ "Basic" : { "Enabled": False }, # Clear text; best avoided
+ "Digest" : { # Digest challenge/response
+ "Enabled": True,
+ "Algorithm": "md5",
+ "Qop": ""
+ },
+ "Kerberos": { # Kerberos/SPNEGO
+ "Enabled": False,
+ "Realm": ""
+ },
},
#
@@ -175,6 +182,12 @@
def setDefaults(self, defaults):
self._defaults = copy.deepcopy(defaults)
+ def __setattr__(self, attr, value):
+ if hasattr(self, '_data') and attr in self._data:
+ self._data[attr] = value
+ else:
+ self.__dict__[attr] = value
+
def __getattr__(self, attr):
if attr in self._data:
return self._data[attr]
@@ -191,7 +204,6 @@
if configFile and os.path.exists(configFile):
configDict = readPlist(configFile)
configDict = self.cleanup(configDict)
- configDict = self.cleanup(configDict)
self.update(configDict)
def cleanup(self, configDict):
Modified: CalendarServer/trunk/twistedcaldav/test/test_config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_config.py 2007-03-14 20:45:04 UTC (rev 1385)
+++ CalendarServer/trunk/twistedcaldav/test/test_config.py 2007-03-14 21:02:45 UTC (rev 1386)
@@ -93,6 +93,15 @@
self.assertEquals(config.HTTPPort, 8008)
+ def testSetAttr(self):
+ self.assertNotIn('BindAddresses', config.__dict__)
+
+ config.BindAddresses = ['127.0.0.1']
+
+ self.assertNotIn('BindAddresses', config.__dict__)
+
+ self.assertEquals(config.BindAddresses, ['127.0.0.1'])
+
def testUpdating(self):
self.assertEquals(config.SSLPort, -1)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070314/674cbebf/attachment.html
More information about the calendarserver-changes
mailing list