[gen] Bugfixes.

This commit is contained in:
Gaetan Delannay 2014-06-24 21:05:01 +02:00
parent 98b748cfb1
commit 8511bcd675
2 changed files with 5 additions and 2 deletions

View file

@ -921,8 +921,11 @@ class Ref(Field):
# It is a tuple ('sort', method). Perform a full sort.
refs.append(uid)
tool = zobj.getTool()
refs.sort(key=lambda uid:self.insert[1](obj, \
# Warning: "refs" is a persistent list whose method "sort" has no
# param "key".
refs.data.sort(key=lambda uid:self.insert[1](obj, \
tool.getObject(uid, appy=True)))
refs._p_changed = 1
# Update the back reference
if not back: self.back.linkObject(value, obj, back=True)

View file

@ -322,7 +322,7 @@ class Transition:
# Condition is a role. Transition may be triggered if the user has
# this role.
return user.has_role(self.condition.name, obj)
elif type(self.condition) == types.FunctionType:
elif callable(self.condition):
return self.condition(wf, obj.appy())
elif type(self.condition) in (tuple, list):
# It is a list of roles and/or functions. Transition may be