Changeset 12032
- Timestamp:
- 21 Nov 2014, 18:52:43 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/customer.py
r12005 r12032 36 36 from waeup.ikoba.interfaces import ( 37 37 IObjectHistory, IUserAccount, IFileStoreNameChooser, IFileStoreHandler, 38 IIkobaUtils, registration_states_vocab,IExtFileStore,38 IIkobaUtils, IExtFileStore, 39 39 CREATED, REQUESTED, APPROVED) 40 40 from waeup.ikoba.customers.export import EXPORTER_NAMES 41 41 from waeup.ikoba.customers.interfaces import ( 42 ICustomer, ICustomerNavigation, ICSVCustomerExporter) 42 ICustomer, ICustomerNavigation, ICSVCustomerExporter, 43 ICustomersUtils) 43 44 from waeup.ikoba.customers.utils import generate_customer_id 44 45 from waeup.ikoba.customers.documents import CustomerDocumentsContainer … … 126 127 @property 127 128 def translated_state(self): 128 state = registration_states_vocab.getTermByToken( 129 self.state).title 130 return state 129 try: 130 TRANSLATED_STATES = getUtility(ICustomersUtils).TRANSLATED_STATES 131 ts = TRANSLATED_STATES[self.state] 132 return ts 133 except KeyError: 134 return 131 135 132 136 @property -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/export.py
r12018 r12032 23 23 from zope.component import getUtility 24 24 from waeup.ikoba.interfaces import ( 25 IExtFileStore, IFileStoreNameChooser , IIkobaUtils)25 IExtFileStore, IFileStoreNameChooser) 26 26 from waeup.ikoba.interfaces import MessageFactory as _ 27 27 from waeup.ikoba.customers.catalog import CustomersQuery … … 147 147 ICustomerDocument, 148 148 exclude_attribs=False, 149 omit=['is_editable' ]))) + (149 omit=['is_editable', 'translated_state']))) + ( 150 150 'customer_id',) 151 151 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/utils.py
r12018 r12032 19 19 """ 20 20 import grok 21 from waeup.ikoba.interfaces import STARTED, APPROVED 21 from waeup.ikoba.interfaces import MessageFactory as _ 22 from waeup.ikoba.interfaces import CREATED, STARTED, REQUESTED, APPROVED 22 23 from waeup.ikoba.customers.interfaces import ICustomersUtils 23 24 … … 41 42 42 43 DOCMANAGE_STATES = (APPROVED,) 44 45 TRANSLATED_STATES = { 46 CREATED: _('created'), 47 STARTED: _('started'), 48 REQUESTED: _('requested'), 49 APPROVED: _('approved'), 50 } -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/document.py
r12017 r12032 32 32 from waeup.ikoba.utils.helpers import attrs_to_fields, get_current_principal 33 33 from waeup.ikoba.utils.logger import Logger 34 from waeup.ikoba.documents.interfaces import IDocument, IDocument 34 from waeup.ikoba.documents.interfaces import ( 35 IDocument, IDocument, IDocumentsUtils) 35 36 from waeup.ikoba.documents.utils import generate_document_id 36 37 … … 52 53 return 53 54 54 #def __init__(self):55 # super(Document, self).__init__()56 # timestamp = ("%d" % int(time()*10000))[1:]57 # self.document_id = "d%s" % timestamp58 # return59 60 55 def __init__(self): 61 56 super(Document, self).__init__() … … 76 71 state = IWorkflowState(self).getState() 77 72 return state 73 74 @property 75 def translated_state(self): 76 try: 77 TRANSLATED_STATES = getUtility(IDocumentsUtils).TRANSLATED_STATES 78 ts = TRANSLATED_STATES[self.state] 79 return ts 80 except KeyError: 81 return 78 82 79 83 Document = attrs_to_fields(Document) -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/interfaces.py
r12018 r12032 19 19 from zope import schema 20 20 from waeup.ikoba.interfaces import ( 21 IIkobaObject, SimpleIkobaVocabulary,21 IIkobaObject, 22 22 ContextualDictSourceFactoryBase) 23 23 from waeup.ikoba.interfaces import MessageFactory as _ 24 24 25 25 26 class DocumentTypeSource(ContextualDictSourceFactoryBase): … … 46 47 history = Attribute('Object history, a list of messages') 47 48 state = Attribute('Returns the verification state of a document') 49 translated_state = Attribute( 50 'Returns a translated, more verbose verification state of a document') 48 51 49 52 title = schema.TextLine( -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/utils.py
r12018 r12032 19 19 """ 20 20 import grok 21 from waeup.ikoba.interfaces import MessageFactory as _ 21 22 from waeup.ikoba.documents.workflow import CREATED 22 23 from waeup.ikoba.documents.interfaces import IDocumentsUtils 24 from waeup.ikoba.documents.workflow import ( 25 CREATED, SUBMITTED, 26 VERIFIED, REJECTED, OUTDATED) 23 27 24 28 … … 34 38 35 39 DOCMANAGE_STATES = (CREATED,) 40 41 TRANSLATED_STATES = { 42 CREATED: _('document created'), 43 SUBMITTED: _('document submitted'), 44 VERIFIED: _('document verified'), 45 REJECTED: _('document rejected'), 46 OUTDATED:_('document outdated') 47 } -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/workflow.py
r12015 r12032 24 24 from hurry.workflow.interfaces import IWorkflowState, IWorkflowTransitionEvent 25 25 from waeup.ikoba.interfaces import ( 26 IObjectHistory, IIkobaWorkflowInfo, IIkobaUtils) 26 IObjectHistory, IIkobaWorkflowInfo, 27 SimpleIkobaVocabulary) 27 28 from waeup.ikoba.interfaces import MessageFactory as _ 28 29 from waeup.ikoba.workflow import IkobaWorkflow, IkobaWorkflowInfo -
main/waeup.ikoba/trunk/src/waeup/ikoba/interfaces.py
r11981 r12032 83 83 application_sessions_vocab = SimpleIkobaVocabulary(*application_sessions()) 84 84 85 registration_states_vocab = SimpleIkobaVocabulary(86 (_('created'), CREATED),87 (_('started'), STARTED),88 (_('requested'), REQUESTED),89 (_('approved'), APPROVED),90 )91 92 85 class ContextualDictSourceFactoryBase(SmartBasicContextualSourceFactory): 93 86 """A base for contextual sources based on IkobaUtils dicts.
Note: See TracChangeset for help on using the changeset viewer.