[gen] String field: bugfix when ajax-editing an empty multilingual field.

This commit is contained in:
Gaetan Delannay 2015-01-30 12:02:39 +01:00
parent 9d6aa23ae6
commit f047242d81
2 changed files with 7 additions and 5 deletions

View file

@ -908,12 +908,14 @@ class String(Field):
rq = obj.REQUEST rq = obj.REQUEST
if rq.get('cancel') == 'True': return if rq.get('cancel') == 'True': return
requestValue = rq['fieldContent'] requestValue = rq['fieldContent']
# Remember previous value if the field is historized. # Remember previous value if the field is historized
previousData = obj.rememberPreviousData([self]) previousData = obj.rememberPreviousData([self])
if self.isMultilingual(obj): if self.isMultilingual(obj):
# We take a copy of previousData because it is mutable (dict). # We take a copy of previousData because it is mutable (dict)
previousData[self.name] = previousData[self.name].copy() prevData = previousData[self.name]
# We get a partial value, for one language only. if prevData != None: prevData = prevData.copy()
previousData[self.name] = prevData
# We get a partial value, for one language only
language = rq['languageOnly'] language = rq['languageOnly']
v = self.getUnilingualStorableValue(obj, requestValue) v = self.getUnilingualStorableValue(obj, requestValue)
getattr(obj.aq_base, self.name)[language] = v getattr(obj.aq_base, self.name)[language] = v

View file

@ -461,7 +461,7 @@ class Renderer:
return self.stylesManager.styles return self.stylesManager.styles
def setStylesMapping(self, stylesMapping): def setStylesMapping(self, stylesMapping):
'''Establishes a correspondance between, on one hand, CSS styles or '''Establishes a correspondence between, on one hand, CSS styles or
XHTML tags that will be found inside XHTML content given to POD, XHTML tags that will be found inside XHTML content given to POD,
and, on the other hand, ODT styles found into the template.''' and, on the other hand, ODT styles found into the template.'''
try: try: