Changeset 12053 for main/waeup.ikoba/trunk/src/waeup/ikoba/documents
- Timestamp:
- 25 Nov 2014, 08:19:54 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/documents
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/document.py
r12032 r12053 76 76 try: 77 77 TRANSLATED_STATES = getUtility(IDocumentsUtils).TRANSLATED_STATES 78 ts = TRANSLATED_STATES[self.state] 79 return ts 78 return TRANSLATED_STATES[self.state] 80 79 except KeyError: 81 80 return 81 82 @property 83 def classname(self): 84 return self.__class__.__name__ 85 86 @property 87 def formatted_transition_date(self): 88 try: 89 return self.last_transition_date.strftime('%Y-%m-%d %H:%M:%S') 90 except AttributeError: 91 return 92 82 93 83 94 Document = attrs_to_fields(Document) -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/interfaces.py
r12032 r12053 49 49 translated_state = Attribute( 50 50 'Returns a translated, more verbose verification state of a document') 51 classname = Attribute('Name of the document class') 52 formatted_transition_date = Attribute('Last transition formatted date string') 51 53 52 54 title = schema.TextLine( … … 55 57 ) 56 58 59 last_transition_date = schema.Datetime( 60 title = _(u'Last Transition Date'), 61 required = False, 62 readonly = False, 63 ) 64 65 57 66 class IDocumentsUtils(Interface): 58 67 """A collection of methods which are subject to customization. -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/workflow.py
r12032 r12053 124 124 @grok.subscribe(IDocument, IWorkflowTransitionEvent) 125 125 def handle_document_transition_event(obj, event): 126 """Append message to document history and log file when transition happened. 126 """Append message to document history and log file and update 127 last_transition_date when transition happened. 127 128 """ 128 129 msg = event.transition.user_data['msg'] 129 130 history = IObjectHistory(obj) 130 131 history.addMessage(msg) 132 obj.last_transition_date = datetime.utcnow() 131 133 try: 132 134 customers_container = grok.getSite()['customers']
Note: See TracChangeset for help on using the changeset viewer.