Update of /cvsroot/cvs-syncmail/syncmail
In directory sc8-pr-cvs1:/tmp/cvs-serv26744
Modified Files:
Tag: new-config-branch
syncmail tests.py
Log Message:
Various small corrections and simplifications.
Index: tests.py
===================================================================
RCS file: /cvsroot/cvs-syncmail/syncmail/Attic/tests.py,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -d -r1.1.2.3 -r1.1.2.4
--- tests.py 10 Jul 2003 16:52:29 -0000 1.1.2.3
+++ tests.py 10 Jul 2003 18:48:06 -0000 1.1.2.4
@@ -84,8 +84,8 @@
eq(options.get('third'), 'three')
eq(options.get('fourth'), 'four')
eq(options.get('missing'), None)
-eq(options.get('common', 'splat'), '1')
-eq(options.get('third', 'foo'), 'three')
+eq(options.get('common'), '1')
+eq(options.get('third'), 'three')
options = OptionLookup([{"foo": "bar",
"branch": "$BRANCH",
Index: syncmail
===================================================================
RCS file: /cvsroot/cvs-syncmail/syncmail/syncmail,v
retrieving revision 1.36.2.6
retrieving revision 1.36.2.7
diff -u -d -r1.36.2.6 -r1.36.2.7
--- syncmail 10 Jul 2003 16:56:41 -0000 1.36.2.6
+++ syncmail 10 Jul 2003 18:48:05 -0000 1.36.2.7
@@ -386,31 +386,30 @@
"HOSTNAME": os.environ.get("HOSTNAME") or getfqdn(),
})
- def get(self, option, default=None):
+ def get(self, option):
for dict in self._dicts:
v = dict.get(option)
if v is not None:
return self._replace(v)
- return default
+ return None
- def getbool(self, option, default=None):
+ def getbool(self, option):
v = self.get(option)
- if v is None:
- return default
- v = string.lower(v)
- if v in TRUE_VALUES:
- return 1
- elif v in FALSE_VALUES:
- return 0
- else:
- raise ValueError("illegal boolean value: %s" % `v`)
+ if v is not None:
+ v = string.lower(v)
+ if v in TRUE_VALUES:
+ v = 1
+ elif v in FALSE_VALUES:
+ v = 0
+ else:
+ raise ValueError("illegal boolean value: %s" % `v`)
+ return v
- def getint(self, option, default=None):
+ def getint(self, option):
v = self.get(option)
- if v is None:
- return default
- else:
- return int(v)
+ if v is not None:
+ v = int(v)
+ return v
def getaddress(self, option):
"""Return (host, port) for a host:port or host string.
@@ -576,9 +575,9 @@
self.subject = self.subject_prefix + " changes"
# The remaining args should be the email addresses
if len(args) >= 2:
- people = string.join(args[1:], COMMASPACE)
+ self.people = string.join(args[1:], COMMASPACE)
else:
- people = config.get("to")
+ self.people = config.get("to")
def load_configuration(args, branch=None):
cmdline, args = load_cmdline(args)
@@ -596,9 +595,6 @@
def main():
- # XXX Should really move all the options to an object, just to
- # avoid threading so many positional args through everything.
-
# load the options
config = load_configuration(sys.argv[1:], load_branch_name())
@@ -620,7 +616,7 @@
changes.append(entry)
if config.verbose:
- print 'Mailing %s...' % people
+ print 'Mailing %s...' % config.people
print 'Generating notification message...'
blast_mail(config, changes)
if config.verbose:
|