entities/wfobjs.py
branch3.5
changeset 2948 d3cd8bd20ee5
parent 2947 083593802120
child 2951 d0b77dd27740
equal deleted inserted replaced
2947:083593802120 2948:d3cd8bd20ee5
     7 """
     7 """
     8 __docformat__ = "restructuredtext en"
     8 __docformat__ = "restructuredtext en"
     9 
     9 
    10 from warnings import warn
    10 from warnings import warn
    11 
    11 
    12 from logilab.common.decorators import cached
    12 from logilab.common.decorators import cached, clear_cache
    13 from logilab.common.deprecation import deprecated
    13 from logilab.common.deprecation import deprecated
    14 
    14 
    15 from cubicweb.entities import AnyEntity, fetch_config
    15 from cubicweb.entities import AnyEntity, fetch_config
    16 from cubicweb.interfaces import IWorkflowable
    16 from cubicweb.interfaces import IWorkflowable
    17 from cubicweb.common.mixins import MI_REL_TRIGGERS
    17 from cubicweb.common.mixins import MI_REL_TRIGGERS
   368         # XXX try to find matching transition?
   368         # XXX try to find matching transition?
   369         self.req.create_entity('TrInfo', ('to_state', 'S'),
   369         self.req.create_entity('TrInfo', ('to_state', 'S'),
   370                                ('wf_info_for', 'E'), S=state.eid, E=self.eid,
   370                                ('wf_info_for', 'E'), S=state.eid, E=self.eid,
   371                                **self._get_tr_kwargs(comment, commentformat))
   371                                **self._get_tr_kwargs(comment, commentformat))
   372 
   372 
       
   373 
       
   374     def clear_all_caches(self):
       
   375         super(WorkflowableMixIn, self).clear_all_caches()
       
   376         clear_cache(self, 'cwetype_workflow')
       
   377 
   373     @deprecated('get transition from current workflow and use its may_be_fired method')
   378     @deprecated('get transition from current workflow and use its may_be_fired method')
   374     def can_pass_transition(self, trname):
   379     def can_pass_transition(self, trname):
   375         """return the Transition instance if the current user can fire the
   380         """return the Transition instance if the current user can fire the
   376         transition with the given name, else None
   381         transition with the given name, else None
   377         """
   382         """