Switch to release 3.4.0 of z3c.form, which removes 'subform' inner attribute and handles object factories in a different way
authorThierry Florac <tflorac@ulthar.net>
Sun, 21 May 2017 01:53:17 +0200
changeset 1 bf796b698a98
parent 0 c73bb834ccbe
child 2 b4a9954463b5
Switch to release 3.4.0 of z3c.form, which removes 'subform' inner attribute and handles object factories in a different way
src/pyams_gis/widget/area.py
src/pyams_gis/widget/point.py
src/pyams_gis/widget/templates/geoarea-input.pt
src/pyams_gis/widget/templates/geopoint-input.pt
--- a/src/pyams_gis/widget/area.py	Thu May 18 17:23:48 2017 +0200
+++ b/src/pyams_gis/widget/area.py	Sun May 21 01:53:17 2017 +0200
@@ -46,10 +46,7 @@
         self.widget = widget
 
     def __call__(self, data):
-        result = GeoArea()
-        for name, value in data.items():
-            setattr(result, name, value)
-        return result
+        return GeoArea()
 
 
 @widgettemplate_config(mode='input', template='templates/geoarea-input.pt', layer=IFormLayer)
@@ -59,7 +56,7 @@
 
     def updateWidgets(self, setErrors=True):
         super(GeoAreaWidget, self).updateWidgets()
-        widgets = self.subform.widgets
+        widgets = self.widgets
         widgets['x1'].input_css_class = 'col-md-2'
         widgets['y1'].input_css_class = 'col-md-2'
         widgets['x2'].input_css_class = 'col-md-2'
--- a/src/pyams_gis/widget/point.py	Thu May 18 17:23:48 2017 +0200
+++ b/src/pyams_gis/widget/point.py	Sun May 21 01:53:17 2017 +0200
@@ -46,10 +46,7 @@
         self.widget = widget
 
     def __call__(self, data):
-        result = GeoPoint()
-        for name, value in data.items():
-            setattr(result, name, value)
-        return result
+        return GeoPoint()
 
 
 @widgettemplate_config(mode='input', template='templates/geopoint-input.pt', layer=IFormLayer)
@@ -59,7 +56,7 @@
 
     def updateWidgets(self, setErrors=True):
         super(GeoPointWidget, self).updateWidgets(setErrors)
-        widgets = self.subform.widgets
+        widgets = self.widgets
         widgets['longitude'].input_css_class = 'col-md-2'
         widgets['latitude'].input_css_class = 'col-md-2'
         widgets['longitude'].object_data = {'ams-change-handler': 'PyAMS_GIS.position.changedCoordinate'}
@@ -99,10 +96,7 @@
         self.widget = widget
 
     def __call__(self, data):
-        result = GeoPointZ()
-        for name, value in data.items():
-            setattr(result, name, value)
-        return result
+        return GeoPointZ()
 
 
 @widgettemplate_config(mode='input', template='templates/geopoint-input.pt', layer=IFormLayer)
@@ -112,7 +106,7 @@
 
     def updateWidgets(self, setErrors=True):
         super(GeoPointZWidget, self).updateWidgets(setErrors)
-        widgets = self.subform.widgets
+        widgets = self.widgets
         widgets['longitude'].input_css_class = 'col-md-2'
         widgets['latitude'].input_css_class = 'col-md-2'
         widgets['altitude'].input_css_class = 'col-md-2'
--- a/src/pyams_gis/widget/templates/geoarea-input.pt	Thu May 18 17:23:48 2017 +0200
+++ b/src/pyams_gis/widget/templates/geoarea-input.pt	Sun May 21 01:53:17 2017 +0200
@@ -42,7 +42,7 @@
 				</div>
 			</div>
 		</div>
-		<tal:loop repeat="widget view/subform/widgets/values">
+		<tal:loop repeat="widget view/widgets/values">
 			<input type="hidden"
 				   tal:condition="python:widget.mode == 'hidden'"
 				   tal:replace="structure widget/render" />
--- a/src/pyams_gis/widget/templates/geopoint-input.pt	Thu May 18 17:23:48 2017 +0200
+++ b/src/pyams_gis/widget/templates/geopoint-input.pt	Sun May 21 01:53:17 2017 +0200
@@ -42,7 +42,7 @@
 				</div>
 			</div>
 		</div>
-		<tal:loop repeat="widget view/subform/widgets/values">
+		<tal:loop repeat="widget view/widgets/values">
 			<input type="hidden"
 				   tal:condition="python:widget.mode == 'hidden'"
 				   tal:replace="structure widget/render" />