Changeset 12361 for main/waeup.ikoba/trunk/src/waeup/ikoba/products
- Timestamp:
- 1 Jan 2015, 21:56:40 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/products
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/products/browser.py
r12318 r12361 41 41 FriendlyDatetimeDisplayWidget) 42 42 from waeup.ikoba.browser.breadcrumbs import Breadcrumb 43 from waeup.ikoba.utils.helpers import html2dict 43 44 from waeup.ikoba.browser.pages import ( 44 45 delSubobjects, add_local_role, del_local_roles, msave, … … 189 190 if not new: 190 191 del data['options'] 191 return msave(self, **data) 192 msave(self, **data) 193 # Save multilingual dict 194 tc = getattr(self.context, 'terms_and_conditions', None) 195 portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE 196 self.context.tc_dict = html2dict(tc, portal_language) 197 return 192 198 193 199 @action(_('Cancel'), validator=NullValidator) -
main/waeup.ikoba/trunk/src/waeup/ikoba/products/interfaces.py
r12358 r12361 90 90 show_year = True, 91 91 ) 92 93 tc_dict = Attribute('Terms and Conditions as language dictionary with values in html format') 94 95 terms_and_conditions = schema.Text( 96 title = _(u'Terms and Conditions'), 97 required = False, 98 description = _(u'Multilingual content in HTML format'), 99 ) -
main/waeup.ikoba/trunk/src/waeup/ikoba/products/product.py
r12336 r12361 45 45 'waeup.local.ProductManager', 46 46 ] 47 48 def __init__(self, *args, **kw): 49 super(Product, self).__init__(*args, **kw) 50 self.tc_dict = {} 47 51 48 52 @property -
main/waeup.ikoba/trunk/src/waeup/ikoba/products/tests/test_browser.py
r12358 r12361 193 193 self.assertEqual(self.browser.url, self.manage_product_path) 194 194 self.browser.getControl(name="form.title").value = 'New license' 195 self.browser.getControl(name="form.terms_and_conditions").value = """ 196 <h1>Hello World</h1> 197 >>de<< 198 <h1>Hallo Welt</h1> 199 """ 195 200 self.browser.getControl("Save").click() 196 201 self.assertEqual(self.app['products']['LIC'].title, 'New license') 202 # tc_dict has been saved 203 self.assertEqual(self.app['products']['LIC'].tc_dict, 204 {'de': u'<div id="html">\n<h1>Hallo Welt</h1>\n</div id="html">', 205 'en': u'<div id="html">\n<h1>Hello World</h1>\n</div id="html">'}) 197 206 # Managers can asign local roles 198 207 self.browser.getControl(name="user").value = ['john'] -
main/waeup.ikoba/trunk/src/waeup/ikoba/products/tests/test_export.py
r12358 r12361 63 63 self.assertTrue( 64 64 'contract_category,contract_title,options,' 65 'product_id,t itle,valid_from,valid_to,users_with_local_roles\r\n'66 'license,,"[(u\'Base Fee\', u\'800.6\', u\'USD\')]",LIC, Unnamed'65 'product_id,terms_and_conditions,title,valid_from,valid_to,users_with_local_roles\r\n' 66 'license,,"[(u\'Base Fee\', u\'800.6\', u\'USD\')]",LIC,,Unnamed' 67 67 ',2015-12-04#,,"[{\'user_name\': u\'john\', \'local_role\': ' 68 68 'u\'johnsrole\'}]"\r\n' … … 78 78 self.assertTrue( 79 79 'contract_category,contract_title,options,' 80 'product_id,t itle,valid_from,valid_to,users_with_local_roles\r\n'81 'license,,"[(u\'Base Fee\', u\'800.6\', u\'USD\')]",LIC, Unnamed'80 'product_id,terms_and_conditions,title,valid_from,valid_to,users_with_local_roles\r\n' 81 'license,,"[(u\'Base Fee\', u\'800.6\', u\'USD\')]",LIC,,Unnamed' 82 82 ',2015-12-04#,,"[{\'user_name\': u\'john\', \'local_role\': ' 83 83 'u\'johnsrole\'}]"\r\n'
Note: See TracChangeset for help on using the changeset viewer.