summaryrefslogtreecommitdiff
path: root/optik_ext.py
diff options
context:
space:
mode:
authorSylvain <syt@logilab.fr>2006-07-11 14:04:00 +0200
committerSylvain <syt@logilab.fr>2006-07-11 14:04:00 +0200
commitcc79f5d41b8f212139d6b0bdc520a6cfbeee7f0a (patch)
treecf8e4fc6fd1905313ac3f913ed7dfcfe5ef10bb9 /optik_ext.py
parentdfa0ddb23346e9d979bed28ad5cd72516b9064d9 (diff)
downloadlogilab-common-cc79f5d41b8f212139d6b0bdc520a6cfbeee7f0a.tar.gz
* new "password" option type in optik_ext
* configuration: refactored to support interactive input of a configuration
Diffstat (limited to 'optik_ext.py')
-rw-r--r--optik_ext.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/optik_ext.py b/optik_ext.py
index 499c501..fdaf9fd 100644
--- a/optik_ext.py
+++ b/optik_ext.py
@@ -105,6 +105,13 @@ def check_named(option, opt, value):
<NAME>:<VALUE>"
raise OptionValueError(msg % (opt, value))
+def check_password(option, opt, value):
+ """check a password value (can't be empty)
+ """
+ if value:
+ return value
+ raise OptionValueError("option %s: empty password" % opt)
+
def check_file(option, opt, value):
"""check a file value
return the filepath
@@ -135,7 +142,7 @@ import types
class Option(BaseOption):
"""override optik.Option to add some new option types
"""
- TYPES = BaseOption.TYPES + ("regexp", "csv", 'yn', 'named',
+ TYPES = BaseOption.TYPES + ("regexp", "csv", 'yn', 'named', "password",
"multiple_choice", "file", "font", "color")
TYPE_CHECKER = copy(BaseOption.TYPE_CHECKER)
TYPE_CHECKER["regexp"] = check_regexp
@@ -145,6 +152,7 @@ class Option(BaseOption):
TYPE_CHECKER["multiple_choice"] = check_csv
TYPE_CHECKER["file"] = check_file
TYPE_CHECKER["color"] = check_color
+ TYPE_CHECKER["password"] = check_password
def _check_choice(self):
"""FIXME: need to override this due to optik misdesign"""