summaryrefslogtreecommitdiff
path: root/optik_ext.py
diff options
context:
space:
mode:
authorSylvain <syt@logilab.fr>2006-09-19 12:41:30 +0200
committerSylvain <syt@logilab.fr>2006-09-19 12:41:30 +0200
commitd2f29935e7601247b1a73eec79f262a77805f20e (patch)
tree4ed2d2e64de3f5ae7ec8feac75e75fe1c69fc2ba /optik_ext.py
parentd9eccc57048c373a6c37d51a77a827aa4499b75c (diff)
downloadlogilab-common-d2f29935e7601247b1a73eec79f262a77805f20e.tar.gz
fix named option handling
Diffstat (limited to 'optik_ext.py')
-rw-r--r--optik_ext.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/optik_ext.py b/optik_ext.py
index 6eb73e6..5ce2dfd 100644
--- a/optik_ext.py
+++ b/optik_ext.py
@@ -186,6 +186,21 @@ class Option(BaseOption):
"must not supply choices for type %r" % self.type, self)
BaseOption.CHECK_METHODS[2] = _check_choice
+
+ def process(self, opt, value, values, parser):
+ # First, convert the value(s) to the right type. Howl if any
+ # value(s) are bogus.
+ value = self.convert_value(opt, value)
+ if self.type == 'named':
+ existant = getattr(values, self.dest)
+ if existant:
+ existant.update(value)
+ value = existant
+ # And then take whatever action is expected of us.
+ # This is a separate method to make life easier for
+ # subclasses to add new actions.
+ return self.take_action(
+ self.action, self.dest, opt, value, values, parser)
class OptionParser(BaseParser):
"""override optik.OptionParser to use our Option class