[gen] Bugfixes.

This commit is contained in:
Gaetan Delannay 2014-12-15 19:36:00 +01:00
parent 50bd996c3b
commit 6cd64fdc50
4 changed files with 10 additions and 6 deletions

View file

@ -575,12 +575,12 @@ class Field:
if self.isEmptyValue(obj, value): return '' if self.isEmptyValue(obj, value): return ''
return value return value
def getShownValue(self, obj, value, showChanges=False): def getShownValue(self, obj, value, showChanges=False, language=None):
'''Similar to m_getFormattedValue, but in some contexts, only a part of '''Similar to m_getFormattedValue, but in some contexts, only a part of
p_value must be shown. For example, sometimes we need to display only p_value must be shown. For example, sometimes we need to display only
a language-specific part of a multilingual field (see overridden a language-specific part of a multilingual field (see overridden
method in string.py).''' method in string.py).'''
return self.getFormattedValue(obj, value, showChanges) return self.getFormattedValue(obj, value, showChanges, language)
def getXmlValue(self, obj, value): def getXmlValue(self, obj, value):
'''This method allows a developer to customize the value that will be '''This method allows a developer to customize the value that will be

View file

@ -29,7 +29,7 @@ class Action(Field):
pxView = pxCell = Px(''' pxView = pxCell = Px('''
<form var="formId='%s_%s_form' % (zobj.id, name); <form var="formId='%s_%s_form' % (zobj.id, name);
label=_(field.labelId); label=_(field.labelId);
descr=field.descrId and _(field.descrId) or None; descr=field.hasDescr and _(field.descrId) or None;
buttonWidth=ztool.getButtonWidth(label)" buttonWidth=ztool.getButtonWidth(label)"
id=":formId" action=":ztool.absolute_url() + '/do'" id=":formId" action=":ztool.absolute_url() + '/do'"
style="display:inline"> style="display:inline">

View file

@ -1514,10 +1514,11 @@ class BaseMixin:
return False return False
if parent.meta_type not in ('Folder', 'Temporary Folder'): return parent if parent.meta_type not in ('Folder', 'Temporary Folder'): return parent
def getShownValue(self, name): def getShownValue(self, name='title', language=None):
'''Call field.getShownValue on field named p_name.''' '''Call field.getShownValue on field named p_name.'''
field = self.getAppyType('title') field = self.getAppyType(name)
return field.getShownValue(self, field.getValue(self)) return field.getShownValue(self, field.getValue(self),
language=language)
def getBreadCrumb(self, inPopup=False): def getBreadCrumb(self, inPopup=False):
'''Gets breadcrumb info about this object and its parents (if it must '''Gets breadcrumb info about this object and its parents (if it must

View file

@ -893,6 +893,9 @@ class AbstractWrapper(object):
setattr(appyObj, attrName, attrValue) setattr(appyObj, attrName, attrValue)
except AttributeError, ae: except AttributeError, ae:
if raiseOnWrongAttribute: raise ae if raiseOnWrongAttribute: raise ae
# Call custom early initialization
if executeMethods and hasattr(appyObj, 'onEditEarly'):
appyObj.onEditEarly()
if isField: if isField:
# Link the object to this one # Link the object to this one
field.linkObject(self, appyObj, executeMethods=executeMethods) field.linkObject(self, appyObj, executeMethods=executeMethods)