Changeset 12006 for main/waeup.ikoba/trunk
- Timestamp:
- 20 Nov 2014, 08:32:17 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/catalog.py
r11949 r12006 124 124 if idx_name == 'catalog': 125 125 continue 126 if value is not None:127 if 'session' in idx_name or 'level' in idx_name:128 value = int(value)129 if idx_name in ('level', 'current_level'):130 value = int(value)131 if value not in (10, 999):132 value = (value, value + 90)133 126 if not isinstance(value, tuple): 134 127 value = (value, value) -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/catalog.py
r11997 r12006 1 ## $Id : catalog.py 10465 2013-08-07 11:18:43Z henrik$1 ## $Id$ 2 2 ## 3 3 ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/export.py
r11997 r12006 1 ## $Id : export.py 11757 2014-07-10 12:20:30Z henrik$1 ## $Id$ 2 2 ## 3 3 ## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann … … 27 27 from waeup.ikoba.customers.catalog import CustomersQuery 28 28 from waeup.ikoba.customers.interfaces import ( 29 ICustomer, ICSVCustomerExporter )29 ICustomer, ICSVCustomerExporter, ICustomerDocument) 30 30 from waeup.ikoba.utils.batching import ExporterBase 31 31 from waeup.ikoba.utils.helpers import iface_names, to_timezone … … 33 33 #: A tuple containing all exporter names referring to customers or 34 34 #: subobjects thereof. 35 EXPORTER_NAMES = ('customers', )35 EXPORTER_NAMES = ('customers', 'customerdocuments') 36 36 37 37 … … 40 40 """ 41 41 return cust_filter.query() 42 43 def get_documents(customers): 44 """Get all documents of `customers`. 45 """ 46 documents = [] 47 for customer in customers: 48 for document in customer.get('documents', {}).values(): 49 documents.append(document) 50 return documents 42 51 43 52 … … 127 136 CustomersExporter, self).mangle_value( 128 137 value, name, context=context) 138 139 class CustomerDocumentsExporter(grok.GlobalUtility, CustomerExporterBase): 140 """Exporter for CustomerDocument instances. 141 """ 142 grok.name('customerdocuments') 143 144 #: Fieldnames considered by this exporter 145 fields = tuple( 146 sorted(iface_names( 147 ICustomerDocument, exclude_attribs=False))) + ( 148 'customer_id',) 149 150 #: The title under which this exporter will be displayed 151 title = _(u'Customer Documents') 152 153 def filter_func(self, x, **kw): 154 return get_documents(x, **kw) 155 156 def mangle_value(self, value, name, context=None): 157 """Treat location values special. 158 """ 159 if context is not None: 160 customer = context.customer 161 if name in ('customer_id',) and customer is not None: 162 value = getattr(customer, name, None) 163 return super( 164 CustomerDocumentsExporter, self).mangle_value( 165 value, name, context=context) -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_batching.py
r12005 r12006 38 38 CustomerProcessor, CustomerDocumentProcessor) 39 39 from waeup.ikoba.customers.customer import Customer 40 from waeup.ikoba.customers.documents import CustomerDocument 40 41 from waeup.ikoba.testing import FunctionalLayer, FunctionalTestCase 41 42 … … 116 117 customer.nationality = u'NG' 117 118 119 document = CustomerDocument() 120 document.title = u'My Document' 121 customer['documents'].addDocument(document) 118 122 return customer 119 123 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_customer.py
r11997 r12006 1 ## $Id : test_customer.py 10059 2013-04-05 08:11:29Z henrik$1 ## $Id$ 2 2 ## 3 3 ## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann
Note: See TracChangeset for help on using the changeset viewer.