From 59dc619c7f024bb17d4b4007cc60f8cb15245f6a Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Wed, 18 Sep 2013 15:57:34 +0200 Subject: [PATCH] [gen] Bugfixes. --- fields/__init__.py | 2 +- fields/list.py | 26 +++++++++++++++++--------- fields/string.py | 12 +++++++----- gen/descriptors.py | 4 ++++ 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/fields/__init__.py b/fields/__init__.py index d9125c4..77a3b98 100644 --- a/fields/__init__.py +++ b/fields/__init__.py @@ -81,7 +81,7 @@ class Field: class="discreet">::zobj.translate('descr', field=field)''') # Displays a field help. - pxHelp = Px('''''') # Displays validation-error-related info about a field. diff --git a/fields/list.py b/fields/list.py index 57b2cc5..db57b84 100644 --- a/fields/list.py +++ b/fields/list.py @@ -26,14 +26,14 @@ class List(Field): # PX for rendering a single row. pxRow = Px(''' - - + :field.pxView + fieldName='%s*%d' % (field.name, rowIndex); + tagCss='noStyle'">:field.pxRender - ''') @@ -41,10 +41,12 @@ class List(Field): # PX for rendering the list (shared between pxView and pxEdit). pxTable = Px(''' + id=":'list_%s' % name" class=":isEdit and 'grid' or 'list'" + width=":field.width"> - +
::_(info[1].labelId)::_(info[1].labelId) @@ -669,13 +669,15 @@ class String(Field): "null, evalInnerScripts);}}});"% \ (uid, self.name, uid, self.name, obj.absolute_url(), self.name) - def isSelected(self, obj, vocabValue, dbValue): + def isSelected(self, obj, fieldName, vocabValue, dbValue): '''When displaying a selection box (only for fields with a validator - being a list), must the _vocabValue appear as selected?''' + being a list), must the _vocabValue appear as selected? p_fieldName + is given and used instead of field.name because it may be a a fake + name containing a row number from a field within a list field.''' rq = obj.REQUEST # Get the value we must compare (from request or from database) - if rq.has_key(self.name): - compValue = rq.get(self.name) + if rq.has_key(fieldName): + compValue = rq.get(fieldName) else: compValue = dbValue # Compare the value diff --git a/gen/descriptors.py b/gen/descriptors.py index da86f65..308b627 100644 --- a/gen/descriptors.py +++ b/gen/descriptors.py @@ -326,6 +326,10 @@ class FieldDescriptor: for name, field in self.appyType.fields: label = '%s_%s_%s' % (self.classDescr.name, self.fieldName, name) self.i18n(label, name) + if field.hasDescr: + self.i18n('%s_descr' % label, ' ') + if field.hasHelp: + self.i18n('%s_help' % label, ' ') def walkCalendar(self): # Add i18n-specific messages