Bugfix in the system for refreshing layouts, and removed generation of '_valid' i18n labels, that almost doubled the size of po files and are almost never needed.
This commit is contained in:
parent
3fd2d62b30
commit
cccdc12372
|
@ -1 +1 @@
|
|||
0.6.0
|
||||
0.6.1
|
||||
|
|
|
@ -749,11 +749,11 @@ class Type:
|
|||
return validValue
|
||||
else:
|
||||
if not validValue:
|
||||
return obj.translate('%s_valid' % self.labelId)
|
||||
return obj.translate('field_invalid')
|
||||
except Exception, e:
|
||||
return str(e)
|
||||
except:
|
||||
return obj.translate('%s_valid' % self.labelId)
|
||||
return obj.translate('field_invalid')
|
||||
else:
|
||||
# It is a regular expression
|
||||
if not self.validator.match(value):
|
||||
|
@ -766,7 +766,7 @@ class Type:
|
|||
elif self.validator == String.ALPHANUMERIC:
|
||||
return obj.translate('bad_alphanumeric')
|
||||
else:
|
||||
return obj.translate('%s_valid' % self.labelId)
|
||||
return obj.translate('field_invalid')
|
||||
|
||||
def store(self, obj, value):
|
||||
'''Stores the p_value (produced by m_getStorableValue) that complies to
|
||||
|
|
|
@ -132,7 +132,6 @@ class FieldDescriptor:
|
|||
# Add the POD-related fields on the Tool
|
||||
self.generator.tool.addPodRelatedFields(self)
|
||||
|
||||
notToValidateFields = ('Info', 'Computed', 'Action', 'Pod')
|
||||
def walkAppyType(self):
|
||||
'''Walks into the Appy type definition and gathers data about the
|
||||
i18n labels.'''
|
||||
|
@ -149,13 +148,6 @@ class FieldDescriptor:
|
|||
self.classDescr.addIndexMethod(self)
|
||||
# - searchable ? TODO
|
||||
#if self.appyType.searchable: self.fieldParams['searchable'] = True
|
||||
# - need to generate a field validator?
|
||||
# In all cases excepted for "immutable" fields, add an i18n message for
|
||||
# the validation error for this field.
|
||||
if self.appyType.type not in self.notToValidateFields:
|
||||
label = '%s_%s_valid' % (self.classDescr.name, self.fieldName)
|
||||
poMsg = PoMessage(label, '', PoMessage.DEFAULT_VALID_ERROR)
|
||||
self.generator.labels.append(poMsg)
|
||||
# i18n labels
|
||||
i18nPrefix = "%s_%s" % (self.classDescr.name, self.fieldName)
|
||||
# Create labels for generating them in i18n files.
|
||||
|
|
|
@ -141,6 +141,7 @@ class Generator(AbstractGenerator):
|
|||
msg('yes', '', msg.YES),
|
||||
msg('no', '', msg.NO),
|
||||
msg('field_required', '', msg.FIELD_REQUIRED),
|
||||
msg('field_invalid', '', msg.FIELD_INVALID),
|
||||
msg('file_required', '', msg.FILE_REQUIRED),
|
||||
msg('image_required', '', msg.IMAGE_REQUIRED),
|
||||
]
|
||||
|
|
|
@ -142,9 +142,7 @@ class BaseMixin:
|
|||
for key, value in errors.__dict__.iteritems():
|
||||
resValue = value
|
||||
if not isinstance(resValue, basestring):
|
||||
appyType = self.getAppyType(key)
|
||||
msgId = '%s_valid' % appyType.labelId
|
||||
resValue = self.translate(msgId)
|
||||
resValue = self.translate('field_invalid')
|
||||
setattr(errors, key, resValue)
|
||||
|
||||
def onUpdate(self):
|
||||
|
@ -395,6 +393,14 @@ class BaseMixin:
|
|||
exec 'import %s' % moduleName
|
||||
exec 'reload(%s)' % moduleName
|
||||
exec 'res = %s.%s' % (moduleName, klass.__name__)
|
||||
# More manipulations may have occurred in m_update
|
||||
if hasattr(res, 'update'):
|
||||
parentName = res.__bases__[-1].__name__
|
||||
moduleName = 'Products.%s.Extensions.appyWrappers' % \
|
||||
self.getTool().getAppName()
|
||||
exec 'import %s' % moduleName
|
||||
exec 'parent = %s.%s' % (moduleName, parentName)
|
||||
res.update(parent)
|
||||
return res
|
||||
|
||||
def getAppyType(self, name, asDict=False, className=None):
|
||||
|
|
|
@ -44,7 +44,6 @@ class PoMessage:
|
|||
MSG_showAllStatesInPhase = 'Show all states in phase'
|
||||
USER = 'User'
|
||||
POD_ASKACTION = 'Trigger related action'
|
||||
DEFAULT_VALID_ERROR = 'Please fill or correct this.'
|
||||
REF_NO = 'No object.'
|
||||
REF_ADD = 'Add a new one'
|
||||
REF_NAME = 'Name'
|
||||
|
@ -110,6 +109,7 @@ class PoMessage:
|
|||
NO = 'No'
|
||||
FIELD_REQUIRED = 'Please fill this field.'
|
||||
FILE_REQUIRED = 'Please select a file.'
|
||||
FIELD_INVALID = 'Please fill or correct this.'
|
||||
IMAGE_REQUIRED = 'The uploaded file must be an image.'
|
||||
|
||||
def __init__(self, id, msg, default, fuzzy=False, comments=[],
|
||||
|
|
Loading…
Reference in a new issue