only let user select 'available' workflow items

This commit is contained in:
Frédéric Péters 2012-05-27 21:55:06 +02:00
parent 06c071bdb5
commit fedd8a3ed9
2 changed files with 5 additions and 1 deletions

View File

@ -193,7 +193,7 @@ class WorkflowStatusPage(Directory):
def get_new_item_form [html] (self):
form = Form(enctype='multipart/form-data', action = 'newitem')
options = [(x.key, _(x.description)) for x in item_classes]
options = [(x.key, _(x.description)) for x in item_classes if x.is_available()]
options.sort(cmp=lambda a, b: cmp(a[1],b[1]))
form.add(SingleSelectWidget, 'type', title = _('Type'),
required=True, options = options)

View File

@ -334,6 +334,10 @@ class WorkflowStatusItem:
pass
init = classmethod(init)
def is_available(cls):
return True
is_available = classmethod(is_available)
def render_as_line(self):
return _(self.description)