entities/wfobjs.py
changeset 7990 a673d1d9a738
parent 7894 ad0eeb0f7a8d
child 8190 2a3c1b787688
child 8212 a045d3821990
equal deleted inserted replaced
7989:db76e8aaec29 7990:a673d1d9a738
   249             self._cw.execute('INSERT RQLExpression X: X exprtype "ERQLExpression", '
   249             self._cw.execute('INSERT RQLExpression X: X exprtype "ERQLExpression", '
   250                              'X expression %(expr)s, X mainvars %(mainvars)s, '
   250                              'X expression %(expr)s, X mainvars %(mainvars)s, '
   251                              'T condition X WHERE T eid %(x)s', kwargs)
   251                              'T condition X WHERE T eid %(x)s', kwargs)
   252         # XXX clear caches?
   252         # XXX clear caches?
   253 
   253 
   254     @deprecated('[3.6.1] use set_permission')
       
   255     def set_transition_permissions(self, requiredgroups=(), conditions=(),
       
   256                                    reset=True):
       
   257         return self.set_permissions(requiredgroups, conditions, reset)
       
   258 
       
   259 
   254 
   260 class Transition(BaseTransition):
   255 class Transition(BaseTransition):
   261     """customized class for Transition entities"""
   256     """customized class for Transition entities"""
   262     __regid__ = 'Transition'
   257     __regid__ = 'Transition'
   263 
   258 
   384     This mixin will be automatically set on class supporting the 'in_state'
   379     This mixin will be automatically set on class supporting the 'in_state'
   385     relation (which implies supporting 'wf_info_for' as well)
   380     relation (which implies supporting 'wf_info_for' as well)
   386     """
   381     """
   387 
   382 
   388     @property
   383     @property
   389     @deprecated('[3.5] use printable_state')
       
   390     def displayable_state(self):
       
   391         return self._cw._(self.state)
       
   392     @property
       
   393     @deprecated("[3.9] use entity.cw_adapt_to('IWorkflowable').main_workflow")
   384     @deprecated("[3.9] use entity.cw_adapt_to('IWorkflowable').main_workflow")
   394     def main_workflow(self):
   385     def main_workflow(self):
   395         return self.cw_adapt_to('IWorkflowable').main_workflow
   386         return self.cw_adapt_to('IWorkflowable').main_workflow
   396     @property
   387     @property
   397     @deprecated("[3.9] use entity.cw_adapt_to('IWorkflowable').current_workflow")
   388     @deprecated("[3.9] use entity.cw_adapt_to('IWorkflowable').current_workflow")
   412     @property
   403     @property
   413     @deprecated("[3.9] use entity.cw_adapt_to('IWorkflowable').workflow_history")
   404     @deprecated("[3.9] use entity.cw_adapt_to('IWorkflowable').workflow_history")
   414     def workflow_history(self):
   405     def workflow_history(self):
   415         return self.cw_adapt_to('IWorkflowable').workflow_history
   406         return self.cw_adapt_to('IWorkflowable').workflow_history
   416 
   407 
   417     @deprecated('[3.5] get transition from current workflow and use its may_be_fired method')
       
   418     def can_pass_transition(self, trname):
       
   419         """return the Transition instance if the current user can fire the
       
   420         transition with the given name, else None
       
   421         """
       
   422         tr = self.current_workflow and self.current_workflow.transition_by_name(trname)
       
   423         if tr and tr.may_be_fired(self.eid):
       
   424             return tr
       
   425     @deprecated("[3.9] use entity.cw_adapt_to('IWorkflowable').cwetype_workflow()")
   408     @deprecated("[3.9] use entity.cw_adapt_to('IWorkflowable').cwetype_workflow()")
   426     def cwetype_workflow(self):
   409     def cwetype_workflow(self):
   427         return self.cw_adapt_to('IWorkflowable').main_workflow()
   410         return self.cw_adapt_to('IWorkflowable').main_workflow()
   428     @deprecated("[3.9] use entity.cw_adapt_to('IWorkflowable').latest_trinfo()")
   411     @deprecated("[3.9] use entity.cw_adapt_to('IWorkflowable').latest_trinfo()")
   429     def latest_trinfo(self):
   412     def latest_trinfo(self):
   605         """
   588         """
   606         assert self.current_workflow
   589         assert self.current_workflow
   607         if hasattr(statename, 'eid'):
   590         if hasattr(statename, 'eid'):
   608             stateeid = statename.eid
   591             stateeid = statename.eid
   609         else:
   592         else:
   610             if not isinstance(statename, basestring):
   593             state = self.current_workflow.state_by_name(statename)
   611                 warn('[3.5] give a state name', DeprecationWarning, stacklevel=2)
       
   612                 state = self.current_workflow.state_by_eid(statename)
       
   613             else:
       
   614                 state = self.current_workflow.state_by_name(statename)
       
   615             if state is None:
   594             if state is None:
   616                 raise WorkflowException('not a %s state: %s' % (self.__regid__,
   595                 raise WorkflowException('not a %s state: %s' % (self.__regid__,
   617                                                                 statename))
   596                                                                 statename))
   618             stateeid = state.eid
   597             stateeid = state.eid
   619         # XXX try to find matching transition?
   598         # XXX try to find matching transition?