[gen] appy.Object: allow to get object attributes like accessing dict keys, ie object[attr]; Pod field: bugfix (download name of pod template being links to other pod templates + UI bug); Pod field: Manager does not have all output formats anymore, because in some situations, generating a doc in some formats does make sens (ie for frozen docs); Wrapper.getLastEvent can now work on some history given as parameter instead of object.history.

This commit is contained in:
Gaetan Delannay 2014-11-20 09:47:37 +01:00
parent e6adfe39d4
commit 477a533728
3 changed files with 29 additions and 19 deletions

View file

@ -1122,15 +1122,15 @@ class AbstractWrapper(object):
whose values are the previous field values.'''
self.o.addDataChange(data)
def getLastEvent(self, transition, notBefore=None):
'''Gets, from the object history, the last occurrence of transition
named p_transition. p_transition can be a list of names: in this
case, it returns the most recent occurrence of those transitions. If
p_notBefore is given, it corresponds to a kind of start transition
for the search: we will not search in the history preceding the last
occurrence of this transition.'''
history = self.history
i = len(history)-1
def getLastEvent(self, transition, notBefore=None, history=None):
'''Gets, from the object history (or from p_history if not None), the
last occurrence of transition named p_transition. p_transition can be
a list of names: in this case, it returns the most recent occurrence
of those transitions. If p_notBefore is given, it corresponds to a
kind of start transition for the search: we will not search in the
history preceding the last occurrence of this transition.'''
history = history or self.history
i = len(history) - 1
while i >= 0:
event = history[i]
if notBefore and (event['action'] == notBefore): return