From b98da33d477a313f6c1c4a468d1a82d91fc3edaf Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Wed, 5 Mar 2014 16:19:11 +0100 Subject: [PATCH] [gen] Removed obsolete attribute Field.sync. --- fields/__init__.py | 18 ++---------------- fields/action.py | 4 ++-- fields/boolean.py | 4 ++-- fields/calendar.py | 4 ++-- fields/computed.py | 26 ++++++-------------------- fields/date.py | 4 ++-- fields/file.py | 4 ++-- fields/float.py | 4 ++-- fields/info.py | 4 ++-- fields/integer.py | 4 ++-- fields/list.py | 3 +-- fields/ogone.py | 4 ++-- fields/pod.py | 4 ++-- fields/ref.py | 6 ++---- fields/string.py | 4 ++-- gen/installer.py | 4 ++-- gen/mixins/__init__.py | 19 +++++++------------ gen/model.py | 2 +- 18 files changed, 43 insertions(+), 79 deletions(-) diff --git a/fields/__init__.py b/fields/__init__.py index cb4dbd2..f766b26 100644 --- a/fields/__init__.py +++ b/fields/__init__.py @@ -55,10 +55,9 @@ class Field: layout=field.layouts[layoutType]; name=fieldName|field.name; widgetName = isSearch and ('w_%s' % name) or name; - sync=field.sync[layoutType]; outerValue=value|None; rawValue=not isSearch and zobj.getFieldValue(name, \ - onlyIfSync=True, layoutType=layoutType, outerValue=outerValue); + layoutType=layoutType, outerValue=outerValue); value=not isSearch and \ field.getFormattedValue(zobj, rawValue, showChanges); requestValue=not isSearch and zobj.getRequestFieldValue(name); @@ -108,7 +107,7 @@ class Field: def __init__(self, validator, multiplicity, default, show, page, group, layouts, move, indexed, searchable, specificReadPermission, specificWritePermission, width, height, maxChars, colspan, - master, masterValue, focus, historized, sync, mapping, label, + master, masterValue, focus, historized, mapping, label, sdefault, scolspan, swidth, sheight, persist): # The validator restricts which values may be defined. It can be an # interval (1,None), a list of string values ['choice1', 'choice2'], @@ -185,9 +184,6 @@ class Field: # If we must keep track of changes performed on a field, "historized" # must be set to True. self.historized = historized - # self.sync below determines if the field representations will be - # retrieved in a synchronous way by the browser or not (Ajax). - self.sync = self.formatSync(sync) # Mapping is a dict of contexts that, if specified, are given when # translating the label, descr or help related to this field. self.mapping = self.formatMapping(mapping) @@ -344,16 +340,6 @@ class Field: for r in reqValue: if m == r: return True - def formatSync(self, sync): - '''Creates a dictionary indicating, for every layout type, if the field - value must be retrieved synchronously or not.''' - if isinstance(sync, bool): - sync = {'edit': sync, 'view': sync, 'cell': sync, 'search': sync} - for layoutType in ('edit', 'view', 'search', 'cell'): - if layoutType not in sync: - sync[layoutType] = False - return sync - def formatMapping(self, mapping): '''Creates a dict of mappings, one entry by label type (label, descr, help).''' diff --git a/fields/action.py b/fields/action.py index 36ab937..173b93d 100644 --- a/fields/action.py +++ b/fields/action.py @@ -73,8 +73,8 @@ class Action(Field): Field.__init__(self, None, (0,1), default, show, page, group, layouts, move, indexed, False, specificReadPermission, specificWritePermission, width, height, None, colspan, - master, masterValue, focus, historized, False, mapping, - label, None, None, None, None, False) + master, masterValue, focus, historized, mapping, label, + None, None, None, None, False) self.validable = False def getDefaultLayouts(self): return {'view': 'l-f', 'edit': 'lrv-f'} diff --git a/fields/boolean.py b/fields/boolean.py index e116b84..dc51a46 100644 --- a/fields/boolean.py +++ b/fields/boolean.py @@ -65,8 +65,8 @@ class Boolean(Field): group, layouts, move, indexed, searchable, specificReadPermission, specificWritePermission, width, height, None, colspan, master, masterValue, focus, - historized, True, mapping, label, sdefault, scolspan, - swidth, sheight, persist) + historized, mapping, label, sdefault, scolspan, swidth, + sheight, persist) self.pythonType = bool # Layout including a description diff --git a/fields/calendar.py b/fields/calendar.py index f5b684e..aca207c 100644 --- a/fields/calendar.py +++ b/fields/calendar.py @@ -221,8 +221,8 @@ class Calendar(Field): Field.__init__(self, validator, (0,1), default, show, page, group, layouts, move, False, False, specificReadPermission, specificWritePermission, width, height, None, colspan, - master, masterValue, focus, False, True, mapping, label, - None, None, None, None, True) + master, masterValue, focus, False, mapping, label, None, + None, None, None, True) # eventTypes can be a "static" list or tuple of strings that identify # the types of events that are supported by this calendar. It can also # be a method that computes such a "dynamic" list or tuple. When diff --git a/fields/computed.py b/fields/computed.py index ec89d06..1065a7c 100644 --- a/fields/computed.py +++ b/fields/computed.py @@ -22,21 +22,8 @@ from appy.px import Px class Computed(Field): WRONG_METHOD = 'Wrong value "%s". Param "method" must contain a method ' \ 'or a PX.' - - # Ajax-called view content of a non sync Computed field. - pxViewContent = Px(''' - :field.pxView''') - - pxView = pxCell = pxEdit = Px(''' - - :value::value - -
- -
-
''') + pxView = pxCell = pxEdit = Px(''':value + ::value''') pxSearch = Px('''