Changeset 12229 for main/waeup.ikoba/trunk/src/waeup/ikoba/documents
- Timestamp:
- 14 Dec 2014, 15:45:55 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/browser.py
r12228 r12229 32 32 from zope.schema.interfaces import ConstraintNotSatisfied, RequiredMissing 33 33 from zope.formlib.textwidgets import BytesDisplayWidget 34 from zope.formlib.widget import renderElement35 34 from zope.security import checkPermission 35 from waeup.ikoba.utils.helpers import html2dict 36 36 from waeup.ikoba.interfaces import MessageFactory as _ 37 37 from waeup.ikoba.interfaces import ( … … 233 233 grok.context(IHTMLDocument) 234 234 235 def _html_dict(self):236 value = getattr(self.context, 'html_multilang', None)237 if not value:238 return {}239 parts = value.split('>>')240 elements = {}241 lang = getUtility(IIkobaUtils).PORTAL_LANGUAGE242 for part in parts:243 if part[2:4] == u'<<':244 lang = part[0:2].lower()245 text = part[4:]246 elements[lang] = renderElement(u'div id="html"',247 contents=text)248 else:249 text = part250 elements[lang] = renderElement(u'div id="html"',251 contents=text)252 return elements253 254 235 @action(_('Save'), style='primary') 255 236 def save(self, **data): 256 237 msave(self, **data) 257 self.context.html_dict = self._html_dict() 238 html_multilang = getattr(self.context, 'html_multilang', None) 239 portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE 240 self.context.html_dict = html2dict(html_multilang, portal_language) 258 241 return 259 242
Note: See TracChangeset for help on using the changeset viewer.