def update(self, transition_id=None): if IWorkspaceContainer.providedBy(self.context.__parent__): self._old_url = WorkspaceAbsoluteURLView(self.context, self.request)() workflow = interfaces.IWorkflow(self.context) if transition_id: transition = workflow.get_transition(transition_id) title = translate(_(transition.title), context=self.request) self.status = translate(_( u"Confirmation required for workflow transition: '${title}'", mapping={"title": title}), context=self.request) self.setupActions(transition_id) if (ILegislativeContent.providedBy(self.context) and get_mask(self.context) == "manual" and not self.context.registry_number): self.form_fields = self.form_fields.omit("note", "date_active") else: self.form_fields = self.form_fields.omit("registry_number") if not self.actions: self.form_fields = self.form_fields.omit("note", "date_active") elif not IFeatureAudit.providedBy(self.context): self.form_fields = self.form_fields.omit("note", "date_active") # !+SUPERFLUOUS_ObejctModifiedEvent(mr, nov-2011) the following update() # is causing a ModifiedEvent to be fired, causing a modify change to be # logged (while this workflow change should be just that). super(WorkflowActionViewlet, self).update()
def update(self, transition_id=None): if IWorkspaceContainer.providedBy(self.context.__parent__): self._old_url = WorkspaceAbsoluteURLView( self.context, self.request)() workflow = interfaces.IWorkflow(self.context) if transition_id: transition = workflow.get_transition(transition_id) title = translate(_(transition.title), context=self.request) self.status = translate( _(u"Confirmation required for workflow transition: '${title}'", mapping={"title": title} ), context=self.request) self.setupActions(transition_id) if (ILegislativeContent.providedBy(self.context) and get_mask(self.context) == "manual" and not self.context.registry_number ): self.form_fields = self.form_fields.omit("note", "date_active") else: self.form_fields = self.form_fields.omit("registry_number") if not self.actions: self.form_fields = self.form_fields.omit("note", "date_active") elif not IFeatureAudit.providedBy(self.context): self.form_fields = self.form_fields.omit("note", "date_active") # !+SUPERFLUOUS_ObejctModifiedEvent(mr, nov-2011) the following update() # is causing a ModifiedEvent to be fired, causing a modify change to be # logged (while this workflow change should be just that). super(WorkflowActionViewlet, self).update()
def _get_title_from_context(context): title = None if IAlchemistContent.providedBy(context): if IDCDescriptiveProperties.providedBy(context): title = context.title else: props = IDCDescriptiveProperties(context, None) if props is not None: title = props.title else: """ !+ AttributeError: 'GroupAddress' object has no attribute 'short_name': File "/home/undesa/bungeni/cap_installs/bungeni_install/bungeni/releases/20100305100101/src/bungeni.main/bungeni/ui/viewlets/navigation.py", line 59, in _get_title_from_context #title = context.short_name So, we temporarily default the above to the context.__class__.__name__: """ title = getattr(context, "title", context.__class__.__name__) elif IWorkspaceContainer.providedBy(context): # WorkspaceContainer._class is not set (and not unique) and it breaks the # connection between Container -> ContentClass title = context.__name__ elif IAlchemistContainer.providedBy(context): domain_model = context._class try: descriptor = utils.get_descriptor(domain_model) except KeyError, e: log.warn("TYPE_INFO: no descriptor for model %s " "[container=%s] [error=%s]" % (domain_model, context, e)) descriptor = None name = "" if descriptor: name = getattr(descriptor, "container_name", None) if name is None: name = getattr(descriptor, "display_name", None) if not name: name = getattr(context, "__name__", None) title = name
def next_url(self): if IWorkspaceContainer.providedBy(self.context.__parent__): # check if the object is in the same tab as before. # if it is redirect to the object, if not redirect to the listing if (WorkspaceAbsoluteURLView(self.context, self.request)() == self._old_url): self._next_url = self._old_url else: self._next_url = absoluteURL(self.context.__parent__, self.request) return self._next_url
def next_url(self): if IWorkspaceContainer.providedBy(self.context.__parent__): # check if the object is in the same tab as before. # if it is redirect to the object, if not redirect to the listing if (WorkspaceAbsoluteURLView(self.context, self.request)() == self._old_url): self._next_url = self._old_url else: self._next_url = absoluteURL( self.context.__parent__, self.request) return self._next_url
def _get_title_from_context(context): title = None if IAlchemistContent.providedBy(context): if IDCDescriptiveProperties.providedBy(context): title = context.title else: props = IDCDescriptiveProperties(context, None) if props is not None: title = props.title else: ''' !+ AttributeError: 'GroupAddress' object has no attribute 'short_name': File "/home/undesa/bungeni/cap_installs/bungeni_install/bungeni/releases/20100305100101/src/bungeni.main/bungeni/ui/viewlets/navigation.py", line 59, in _get_title_from_context #title = context.short_name So, we temporarily default the above to the context.__class__.__name__: ''' title = getattr(context, "title", context.__class__.__name__) elif IWorkspaceContainer.providedBy(context): # WorkspaceContainer._class is not set (and not unique) and it breaks the # connection between Container -> ContentClass title = context.__name__ elif IAlchemistContainer.providedBy(context): domain_model = context._class try: descriptor = utils.get_descriptor(domain_model) except KeyError, e: log.warn("TYPE_INFO: no descriptor for model %s " "[container=%s] [error=%s]" % ( domain_model, context, e)) descriptor = None name = "" if descriptor: name = getattr(descriptor, "container_name", None) if name is None: name = getattr(descriptor, "display_name", None) if not name: name = getattr(context, "__name__", None) title = name