diff -r 495862266785 -r 6b46d73823f5 web/views/workflow.py --- a/web/views/workflow.py Wed Sep 23 19:26:38 2009 +0200 +++ b/web/views/workflow.py Wed Sep 23 19:40:19 2009 +0200 @@ -56,14 +56,14 @@ & match_form_params('treid')) def cell_call(self, row, col): - entity = self.rset.get_entity(row, col) - transition = self.req.entity_from_eid(self.req.form['treid']) + entity = self.cw_rset.get_entity(row, col) + transition = self._cw.entity_from_eid(self._cw.form['treid']) dest = transition.destination() - _ = self.req._ + _ = self._cw._ # specify both rset/row/col and entity in case implements selector (and # not entity_implements) is used on custom form - form = self.vreg['forms'].select( - 'changestate', self.req, rset=self.rset, row=row, col=col, + form = self._cw.vreg['forms'].select( + 'changestate', self._cw, rset=self.cw_rset, row=row, col=col, entity=entity, transition=transition, redirect_path=self.redirectpath(entity)) self.w(form.error_message()) @@ -73,10 +73,9 @@ 'st1': _(entity.current_state.name), 'st2': _(dest.name)} self.w(u'

%s

\n' % msg) - trinfo = self.vreg['etypes'].etype_class('TrInfo')(self.req) - self.initialize_varmaker() - trinfo.eid = self.varmaker.next() - subform = self.vreg['forms'].select('edition', self.req, entity=trinfo, + trinfo = self._cw.vreg['etypes'].etype_class('TrInfo')(self._cw) + trinfo.eid = self._cw.varmaker.next() + subform = self._cw.vreg['forms'].select('edition', self._cw, entity=trinfo, mainform=False) subform.field_by_name('by_transition').widget = fwdgs.HiddenInput() form.form_add_subform(subform) @@ -93,13 +92,13 @@ title = _('Workflow history') def cell_call(self, row, col, view=None): - _ = self.req._ - eid = self.rset[row][col] + _ = self._cw._ + eid = self.cw_rset[row][col] sel = 'Any FS,TS,WF,D' rql = ' ORDERBY D DESC WHERE WF wf_info_for X,'\ 'WF from_state FS, WF to_state TS, WF comment C,'\ 'WF creation_date D' - if self.vreg.schema.eschema('CWUser').has_perm(self.req, 'read'): + if self._cw.vreg.schema.eschema('CWUser').has_perm(self._cw, 'read'): sel += ',U,C' rql += ', WF owned_by U?' displaycols = range(5) @@ -111,7 +110,7 @@ headers = (_('from_state'), _('to_state'), _('comment'), _('date')) rql = '%s %s, X eid %%(x)s' % (sel, rql) try: - rset = self.req.execute(rql, {'x': eid}, 'x') + rset = self._cw.execute(rql, {'x': eid}, 'x') except Unauthorized: return if rset: @@ -127,7 +126,7 @@ title = _('Workflow history') def cell_call(self, row, col, view=None): - self.wview('wfhistory', self.rset, row=row, col=col, view=view) + self.wview('wfhistory', self.cw_rset, row=row, col=col, view=view) # workflow actions ############################################################# @@ -142,25 +141,25 @@ order = 10 def fill_menu(self, box, menu): - entity = self.rset.get_entity(self.row or 0, self.col or 0) - menu.label = u'%s: %s' % (self.req._('state'), entity.printable_state) + entity = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0) + menu.label = u'%s: %s' % (self._cw._('state'), entity.printable_state) menu.append_anyway = True super(WorkflowActions, self).fill_menu(box, menu) def actual_actions(self): - entity = self.rset.get_entity(self.row or 0, self.col or 0) + entity = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0) hastr = False for tr in entity.possible_transitions(): url = entity.absolute_url(vid='statuschange', treid=tr.eid) - yield self.build_action(self.req._(tr.name), url) + yield self.build_action(self._cw._(tr.name), url) hastr = True # don't propose to see wf if user can't pass any transition if hastr: wfurl = entity.current_workflow.absolute_url() - yield self.build_action(self.req._('view workflow'), wfurl) + yield self.build_action(self._cw._('view workflow'), wfurl) if entity.workflow_history: wfurl = entity.absolute_url(vid='wfhistory') - yield self.build_action(self.req._('view history'), wfurl) + yield self.build_action(self._cw._('view history'), wfurl) # workflow entity types views ################################################## @@ -170,7 +169,7 @@ __select__ = implements('TrInfo') def cell_call(self, row, col, cellvid=None): - self.w(self.rset.get_entity(row, col).view('reledit', rtype='comment')) + self.w(self.cw_rset.get_entity(row, col).view('reledit', rtype='comment')) class StateInContextView(view.EntityView): @@ -179,7 +178,7 @@ __select__ = implements('State') def cell_call(self, row, col): - self.w(xml_escape(self.view('textincontext', self.rset, + self.w(xml_escape(self.view('textincontext', self.cw_rset, row=row, col=col))) @@ -190,7 +189,7 @@ self.w(entity.view('reledit', rtype='description')) self.w(u'%s' % ( xml_escape(entity.absolute_url(vid='wfgraph')), - xml_escape(self.req._('graphical workflow for %s') % entity.name))) + xml_escape(self._cw._('graphical workflow for %s') % entity.name))) # workflow images ############################################################## @@ -256,9 +255,9 @@ def _generate(self, tmpfile): """display schema information for an entity""" - entity = self.rset.get_entity(self.row, self.col) + entity = self.cw_rset.get_entity(self.cw_row, self.cw_col) visitor = WorkflowVisitor(entity) - prophdlr = WorkflowDotPropsHandler(self.req) + prophdlr = WorkflowDotPropsHandler(self._cw) generator = GraphGenerator(DotBackend('workflow', 'LR', ratio='compress', size='30,12')) return generator.generate(visitor, prophdlr, tmpfile)