provide method for set an individual option
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3912 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
4b3f4bfe98
commit
d8e113c4cd
1 changed files with 17 additions and 0 deletions
|
@ -90,6 +90,23 @@ class LoopsOptions(Options):
|
|||
if rc:
|
||||
raise ExecutionError('\n' + rc)
|
||||
|
||||
def set(self, key, value):
|
||||
options = getattr(self.context, 'options', [])
|
||||
new_opt = []
|
||||
for item in options:
|
||||
parts = item.split(':', 1)
|
||||
if parts[0] == key:
|
||||
if not value:
|
||||
continue
|
||||
if value is True:
|
||||
item = key
|
||||
continue
|
||||
elif isinstance(value, (list, tuple)):
|
||||
value = ','.join(value)
|
||||
item = '%s:%s' % (key, value)
|
||||
new_opt.append(item)
|
||||
self.context.options = new_opt
|
||||
|
||||
|
||||
class TypeOptions(LoopsOptions):
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue