- Timestamp:
- 1 Dec 2014, 05:51:58 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/vocabularies.py
r12098 r12100 26 26 from zc.sourcefactory.basic import BasicSourceFactory 27 27 from zc.sourcefactory.contextual import BasicContextualSourceFactory 28 from waeup.ikoba.interfaces import SimpleIkobaVocabulary 28 from waeup.ikoba.interfaces import SimpleIkobaVocabulary, SUBMITTED, VERIFIED 29 29 from waeup.ikoba.interfaces import MessageFactory as _ 30 30 from waeup.ikoba.utils.helpers import get_sorted_preferred 31 31 from waeup.ikoba.utils.countries import COUNTRIES 32 from waeup.ikoba.sourcefactory import SmartBasicContextualSourceFactory33 34 32 35 33 #: a tuple of tuples (<COUNTRY-NAME>, <ISO-CODE>) with Nigeria first. … … 120 118 121 119 122 class ConCatProductSource( SmartBasicContextualSourceFactory):123 """A n contract category productdelivers all products120 class ConCatProductSource(BasicContextualSourceFactory): 121 """A contract category product source delivers all products 124 122 which belong to a certain contract_category. 125 123 """ 126 def contains(self, context, value):127 concat = getattr(context, 'contract_category', None)128 if value.contract_category == concat:129 return True130 return False131 124 132 125 def getValues(self, context): … … 144 137 def getTitle(self, context, value): 145 138 return "%s - %s" % (value.product_id, value.title) 139 140 141 class CustomerDocumentSource(BasicContextualSourceFactory): 142 """A customer document source delivers all submitted and verfified documents 143 of the context customer. 144 """ 145 146 def getValues(self, context): 147 documents = context.customer['documents'].values() 148 resultlist = [ 149 value for value in documents if value.state in (SUBMITTED, VERIFIED)] 150 return resultlist 151 152 def getToken(self, context, value): 153 return value.document_id 154 155 def getTitle(self, context, value): 156 return "%s - %s" % (value.document_id, value.title)
Note: See TracChangeset for help on using the changeset viewer.