Changeset 12092 for main/waeup.ikoba/trunk/src/waeup/ikoba
- Timestamp:
- 29 Nov 2014, 17:37:58 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/applications.py
r12090 r12092 62 62 grok.provides(IApplication) 63 63 grok.baseclass() 64 65 application_category = None 64 66 65 67 def __init__(self): … … 139 141 """ 140 142 143 application_category = 'sample' 144 141 145 SampleApplication = attrs_to_fields(SampleApplication) 142 146 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/interfaces.py
r12090 r12092 29 29 30 30 from waeup.ikoba.customers.vocabularies import ( 31 contextual_reg_num_source, GenderSource, nats_vocab )31 contextual_reg_num_source, GenderSource, nats_vocab, AppCatProductSource) 32 32 33 33 … … 270 270 'Returns a translated, more verbose appliction state') 271 271 class_name = Attribute('Name of the application class') 272 formatted_transition_date = Attribute('Last transition formatted date string') 272 formatted_transition_date = Attribute( 273 'Last transition formatted date string') 274 application_category = Attribute('Category for the grouping of products') 273 275 274 276 title = schema.TextLine( … … 282 284 readonly = False, 283 285 ) 286 287 product = schema.Choice( 288 title = _(u'Product'), 289 source = AppCatProductSource(), 290 required = False, 291 ) -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/vocabularies.py
r11997 r12092 1 ## $Id : vocabularies.py 9778 2012-12-06 15:45:03Z henrik$1 ## $Id$ 2 2 ## 3 3 ## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann … … 18 18 """Vocabularies and sources for the customer section. 19 19 """ 20 import grok 20 21 from zope.component import getUtility, queryUtility 21 22 from zope.catalog.interfaces import ICatalog … … 29 30 from waeup.ikoba.utils.helpers import get_sorted_preferred 30 31 from waeup.ikoba.utils.countries import COUNTRIES 32 from waeup.ikoba.sourcefactory import SmartBasicContextualSourceFactory 31 33 32 34 … … 116 118 117 119 directlyProvides(contextual_reg_num_source, IContextSourceBinder) 120 121 122 class AppCatProductSource(SmartBasicContextualSourceFactory): 123 """An application category product delivers all products 124 which belong to a certain application_category. 125 """ 126 def contains(self, context, value): 127 appcat = getattr(context, 'application_category', None) 128 if value.application_category == appcat: 129 return True 130 return False 131 132 def getValues(self, context): 133 appcat = getattr(context, 'application_category', None) 134 products = grok.getSite()['products'].values() 135 if not appcat: 136 return products # ????????????????? 137 resultlist = [ 138 value for value in products if value.application_category == appcat] 139 return resultlist 140 141 def getToken(self, context, value): 142 return value.product_id 143 144 def getTitle(self, context, value): 145 return "%s - %s" % (value.product_id, value.title) -
main/waeup.ikoba/trunk/src/waeup/ikoba/utils/utils.py
r12078 r12092 103 103 104 104 APP_CATS_DICT = { 105 'sample': 'Sample Category', 105 106 'license': 'License', 106 107 'no': 'no application',
Note: See TracChangeset for help on using the changeset viewer.