[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Allow fname *and* file contents to be specified.
Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria:/tmp/cvs-serv27142
Modified Files:
Config.py
Log Message:
Allow fname *and* file contents to be specified.
Index: Config.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Config.py,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- Config.py 24 Aug 2004 22:16:08 -0000 1.88
+++ Config.py 4 Jun 2005 13:52:42 -0000 1.89
@@ -341,7 +341,10 @@
else:
return binascii.a2b_base64(s)
except (TypeError, binascii.Error, binascii.Incomplete):
- raise ConfigError("Invalid Base64 data")
+ if _hexmode:
+ raise ConfigError("Invalid hexadecimal data")
+ else:
+ raise ConfigError("Invalid Base64 data")
def _parseHex(s):
"""Validation function. Converts a hex-64 encoded config value into
@@ -388,7 +391,7 @@
_time_re = re.compile(r"^(\d\d\d\d)-(\d\d)-(\d\d)\s+"
r"(\d\d):(\d\d):(\d\d)((?:\.\d\d\d)?)$")
def _parseTime(s):
- """Validation function. Converts from YYYY/MM/DD HH:MM:SS format
+ """Validation function. Converts from YYYY-MM-DD HH:MM:SS format
to a (float) time value for GMT."""
m = _time_re.match(s.strip())
if not m:
@@ -752,13 +755,9 @@
self.assumeValid = assumeValid
- if filename:
- assert string is None
+ if filename and not string:
string = mixminion.Common.readPossiblyGzippedFile(filename)
- self.fname = filename
- else:
- assert string is not None
- self.fname = None
+ self.fname = filename
self.__load(string)
@@ -987,7 +986,8 @@
{ '__SECTION__' : ('ALLOW', None, None),
'ServerURL' : ('ALLOW*', None, None),
'MaxSkew' : ('ALLOW', "interval", "10 minutes"),
- 'DirectoryTimeout' : ('ALLOW', "interval", "1 minute") },
+ 'DirectoryTimeout' : ('ALLOW', "interval", "1 minute"),
+ 'AllowOldDirectoryFormat': ("ALLOW", 'boolean', 'true') },
'User' : { 'UserDir' : ('ALLOW', "filename", DEFAULT_USER_DIR) },
'Security' : { 'SURBAddress' : ('ALLOW', None, None),
'SURBLifetime' : ('ALLOW', "interval", "7 days"),
@@ -1058,15 +1058,15 @@
return 120
def isServerConfig(self):
- """DOCDOC"""
+ """Return true iff this is a server configuration."""
return 0
def getUserDirectory(self):
- """DOCDOC"""
+ """Return the configured user directory."""
return os.path.expanduser(self["User"].get("UserDir",DEFAULT_USER_DIR))
def getDirectoryRoot(self):
- """DOCDOC"""
+ """Return the location where mixminion should store its files."""
return self.getUserDirectory()
def _validateHostSection(sec):