[Checkins] SVN: grokproject/trunk/grokproject/utils.py Accept
yes/no for boolean options (next to 0/1/true/false)
Maurits van Rees
m.van.rees at zestsoftware.nl
Sun May 4 19:43:01 EDT 2008
Log message for revision 86430:
Accept yes/no for boolean options (next to 0/1/true/false)
Changed:
U grokproject/trunk/grokproject/utils.py
-=-
Modified: grokproject/trunk/grokproject/utils.py
===================================================================
--- grokproject/trunk/grokproject/utils.py 2008-05-04 23:07:12 UTC (rev 86429)
+++ grokproject/trunk/grokproject/utils.py 2008-05-04 23:43:00 UTC (rev 86430)
@@ -22,11 +22,13 @@
if self.getter is None:
self.getter = lambda x, y: self.default
+
def get_var(vars, name):
for var in vars:
if var.name == name:
return var
+
def create_buildout_default_file():
default_dir = os.path.join(HOME, '.buildout')
if not os.path.isdir(default_dir):
@@ -43,6 +45,7 @@
config_file.write(contents)
config_file.close()
+
def get_boolean_value_for_option(vars, option):
value = vars.get(option.name)
if value is not None:
@@ -51,12 +54,12 @@
else:
want_boolean = False
value = value.lower()
- if value in ('1', 'true'):
+ if value in ('1', 'true', 'yes'):
if want_boolean:
value = True
else:
value = 'true'
- elif value in ('0', 'false'):
+ elif value in ('0', 'false', 'no'):
if want_boolean:
value = False
else:
@@ -134,6 +137,7 @@
if line.startswith('grok ='):
return line.split(' ')[-1]
+
def install_grok(target_dir=None, version=None, links=None):
from zc.buildout.easy_install import install
from zc.buildout.easy_install import MissingDistribution
More information about the Checkins
mailing list