Changeset 12343
- Timestamp:
- 30 Dec 2014, 12:52:40 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r12342 r12343 1293 1293 # from the chosen product. 1294 1294 self.assertTrue('<option selected="selected" value="Any product option">' 1295 'Any product option @ 88.8 E UR</option>'1295 'Any product option @ 88.8 Euro</option>' 1296 1296 in self.browser.contents) 1297 1297 self.assertTrue('<option value="First option">First option ' 1298 '@ 99.9 US D</option>' in self.browser.contents)1298 '@ 99.9 US Dollar</option>' in self.browser.contents) 1299 1299 # In test browser we can at least replace the option 1300 1300 self.browser.getControl( … … 1304 1304 self.assertEqual(contract.product_options[0].title, 'First option') 1305 1305 self.browser.getLink("View").click() 1306 self.assertTrue('<span>First option @ 99.9 US D</span>' in self.browser.contents)1306 self.assertTrue('<span>First option @ 99.9 US Dollar</span>' in self.browser.contents) 1307 1307 self.assertEqual(self.browser.url, self.contracts_path + '/%s/index' % conid) 1308 1308 # An href attribute is referring to the document and product objects -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/vocabularies.py
r12340 r12343 33 33 from waeup.ikoba.utils.helpers import get_sorted_preferred 34 34 from waeup.ikoba.utils.countries import COUNTRIES 35 from waeup.ikoba.payments.currencies import ISO_4217_CURRENCIES 35 36 36 37 #: a tuple of tuples (<COUNTRY-NAME>, <ISO-CODE>) with Nigeria first. … … 203 204 204 205 def getTitle(self, context, value): 205 return "%s @ %s %s" % (value.title, value.fee, value.currency) 206 currency = ISO_4217_CURRENCIES[value.currency][1] 207 return "%s @ %s %s" % (value.title, value.fee, currency) -
main/waeup.ikoba/trunk/src/waeup/ikoba/interfaces.py
r12342 r12343 86 86 SimpleTerm(value, value, title) for title, value in terms]) 87 87 88 currencies = SimpleIkobaVocabulary(89 (_('NGN'),'NGN'),90 (_('USD'),'USD'),91 (_('EUR'),'EUR'),92 )93 94 88 class ContextualDictSourceFactoryBase(SmartBasicContextualSourceFactory): 95 89 """A base for contextual sources based on IkobaUtils dicts. … … 211 205 return value 212 206 213 # We have to keep the following two classes here. In products.interfaces they214 # will cause circular imports.215 class IProductOption(Interface):216 """A product option entry.217 218 """219 title = schema.TextLine(220 title = _(u'Title'),221 required = True,222 )223 fee = schema.Decimal(224 title = _(u'Fee'),225 required = False,226 )227 currency = schema.Choice(228 title = _(u'Currency'),229 vocabulary = currencies,230 required = False,231 )232 233 class IProductOptionField(IObject):234 """A zope.schema-like field for usage in interfaces.235 236 Marker interface to distuingish product options from ordinary237 object fields. Needed for registration of widgets.238 """239 240 207 class IIkobaUtils(Interface): 241 208 """A collection of methods which are subject to customization. -
main/waeup.ikoba/trunk/src/waeup/ikoba/products/productoptions.py
r12331 r12343 16 16 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 17 ## 18 """Components representing and aggregating product options.18 """Components with interfaces representing and aggregating product options. 19 19 """ 20 20 import grok 21 21 from decimal import Decimal 22 from zope import schema 23 from zope.schema.interfaces import IObject 24 from zope.interface import Attribute, Interface 22 25 from zope.formlib.interfaces import IInputWidget, IDisplayWidget 23 26 from zope.publisher.interfaces.browser import IBrowserRequest 24 27 from zope.schema.fieldproperty import FieldProperty 25 28 from zope.schema import Object 26 from waeup.ikoba.interfaces import IProductOption, IProductOptionField 29 from waeup.ikoba.interfaces import SimpleIkobaVocabulary 30 from waeup.ikoba.interfaces import MessageFactory as _ 27 31 from waeup.ikoba.widgets.objectwidget import ( 28 32 IkobaObjectWidget, IkobaObjectDisplayWidget 29 33 ) 34 from waeup.ikoba.payments.currencies import ISO_4217_CURRENCIES_VOCAB as currencies 35 36 #currencies = SimpleIkobaVocabulary( 37 # (_('NGN'),'NGN'), 38 # (_('USD'),'USD'), 39 # (_('EUR'),'EUR'), 40 # ) 41 42 class IProductOption(Interface): 43 """A product option entry. 44 45 """ 46 title = schema.TextLine( 47 title = _(u'Title'), 48 required = True, 49 ) 50 fee = schema.Decimal( 51 title = _(u'Fee'), 52 required = False, 53 ) 54 currency = schema.Choice( 55 title = _(u'Currency'), 56 vocabulary = currencies, 57 required = False, 58 ) 59 60 class IProductOptionField(IObject): 61 """A zope.schema-like field for usage in interfaces. 62 63 Marker interface to distuingish product options from ordinary 64 object fields. Needed for registration of widgets. 65 """ 30 66 31 67 class ProductOption(grok.Model): -
main/waeup.ikoba/trunk/src/waeup/ikoba/products/tests/test_productoptions.py
r12342 r12343 5 5 from zope.interface.verify import verifyObject, verifyClass 6 6 from zope.schema.interfaces import ConstraintNotSatisfied, WrongType 7 from waeup.ikoba.interfaces import IProductOption, IProductOptionField, IIkobaUtils 8 from waeup.ikoba.products.productoptions import ProductOption, ProductOptionField 7 from waeup.ikoba.interfaces import IIkobaUtils 8 from waeup.ikoba.products.productoptions import ( 9 IProductOption, IProductOptionField, ProductOption, ProductOptionField) 9 10 from waeup.ikoba.utils.utils import IkobaUtils 10 11 -
main/waeup.ikoba/trunk/src/waeup/ikoba/utils/converters.py
r12327 r12343 30 30 from zope.schema.interfaces import IList 31 31 from waeup.ikoba.interfaces import ( 32 IObjectConverter, I ProductOptionField, IFieldConverter,32 IObjectConverter, IFieldConverter, 33 33 DELETION_MARKER, IGNORE_MARKER) 34 34 from waeup.ikoba.schema.interfaces import IPhoneNumber 35 from waeup.ikoba.products.productoptions import ProductOption 35 from waeup.ikoba.products.productoptions import ( 36 IProductOptionField, ProductOption) 36 37 37 38 class ExtendedCheckBoxWidget(CheckBoxWidget):
Note: See TracChangeset for help on using the changeset viewer.