[Twisted-Python] t.p.usage suggestion: '--option='
![](https://secure.gravatar.com/avatar/0b90087ed4aef703541f1cafdb4b49a1.jpg?s=120&d=mm&r=g)
As it is now, twisted.python.usage will not allow parameters to have empty strings as values. That is, these are invalid currently: --foo= --foo='' (the same thing, more explicitly) --foo '' I think t.p.usage should not be dictating such policy for its users. It seems this only concerns optParameters users, "def opt_foo(self, x)" seems to be immune to this problem if I'm reading the code correctly. All the above cases are easily detectable, Here's a suggested patch; tell me if you want me to commit. Index: twisted/python/usage.py =================================================================== RCS file: /cvs/Twisted/twisted/python/usage.py,v retrieving revision 1.36 diff -u -r1.36 usage.py --- twisted/python/usage.py 10 Nov 2002 10:45:36 -0000 1.36 +++ twisted/python/usage.py 29 Dec 2002 17:06:03 -0000 @@ -242,7 +242,7 @@ self.opts[flagName] = 1 def _generic_parameter(self, parameterName, value): - if value in ('', None): + if value is None: raise UsageError, ("Parameter '%s' requires an argument." % (parameterName,)) -- :(){ :|:&};:
participants (1)
-
Tommi Virtanen