Commit d99693e6 authored by Nicolas Delaby's avatar Nicolas Delaby

FormulatorPatch has been merged with Formulator

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26873 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8b8f9f00
...@@ -31,7 +31,6 @@ from Products.Formulator.Field import ZMIField ...@@ -31,7 +31,6 @@ from Products.Formulator.Field import ZMIField
from Products.Formulator import StandardFields from Products.Formulator import StandardFields
from Products.Formulator.DummyField import fields from Products.Formulator.DummyField import fields
from Products.PythonScripts.Utility import allow_class from Products.PythonScripts.Utility import allow_class
from Products.ERP5Form import FormulatorPatch
from zLOG import LOG from zLOG import LOG
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
...@@ -41,7 +40,7 @@ MINUTE_IN_SECOND = 60 ...@@ -41,7 +40,7 @@ MINUTE_IN_SECOND = 60
HOUR_IN_SECOND = 3600 HOUR_IN_SECOND = 3600
# DAY_IN_SECOND = 86400 # DAY_IN_SECOND = 86400
class DurationWidget(FormulatorPatch.IntegerWidget): class DurationWidget(Widget.IntegerWidget):
""" """
Duration Widget is used to enter time duration. Duration Widget is used to enter time duration.
It may be used in movement of Labour (in Task, Calendat Period, ...). It may be used in movement of Labour (in Task, Calendat Period, ...).
...@@ -101,25 +100,20 @@ class DurationWidget(FormulatorPatch.IntegerWidget): ...@@ -101,25 +100,20 @@ class DurationWidget(FormulatorPatch.IntegerWidget):
""" """
Render dynamically a subfield Render dynamically a subfield
""" """
return FormulatorPatch.IntegerFieldWidgetInstance.render_view(field, value, return self.render_view(field, value, REQUEST=REQUEST)
REQUEST=REQUEST)
def render_sub_field(self, field, key, value, REQUEST, keyword, render_prefix=None): def render_sub_field(self, field, key, value, REQUEST, keyword, render_prefix=None):
""" """
Render dynamically a subfield Render dynamically a subfield
""" """
return FormulatorPatch.IntegerFieldWidgetInstance.render( return Widget.IntegerWidget.render(self, field, field.generate_subfield_key(keyword, key=key),
field, value, REQUEST)
field.generate_subfield_key(keyword,
key=key),
value,
REQUEST)
class DurationValidator(Validator.IntegerValidator): class DurationValidator(Validator.IntegerValidator):
""" """
Duration Validator Duration Validator
""" """
def validate(self, field, key, REQUEST): def validate(self, field, key, REQUEST):
second_value = None second_value = None
for sub_key, convertion in (('hour', HOUR_IN_SECOND), for sub_key, convertion in (('hour', HOUR_IN_SECOND),
('minute', MINUTE_IN_SECOND), ('minute', MINUTE_IN_SECOND),
...@@ -128,7 +122,7 @@ class DurationValidator(Validator.IntegerValidator): ...@@ -128,7 +122,7 @@ class DurationValidator(Validator.IntegerValidator):
field, key, REQUEST, sub_key, convertion, second_value, field, key, REQUEST, sub_key, convertion, second_value,
) )
return second_value return second_value
def _validate_sub_field(self, field, key, REQUEST, sub_key, def _validate_sub_field(self, field, key, REQUEST, sub_key,
convertion, second_value): convertion, second_value):
""" """
......
This diff is collapsed.
...@@ -80,7 +80,7 @@ class TestRenderViewAPI(unittest.TestCase): ...@@ -80,7 +80,7 @@ class TestRenderViewAPI(unittest.TestCase):
field.render_view.im_func.func_code.co_varnames) field.render_view.im_func.func_code.co_varnames)
if field is not ProxyField.ProxyField: if field is not ProxyField.ProxyField:
self.assertEquals(('self', 'field', 'value', 'REQUEST'), self.assertEquals(('self', 'field', 'value', 'REQUEST'),
field.widget.render_view.im_func.func_code.co_varnames[:4]) field.widget.render_view.im_func.func_code.co_varnames[:4], '%s %s' % (field.widget, field.widget.render_view.im_func.func_code.co_varnames[:4]))
class TestFloatField(unittest.TestCase): class TestFloatField(unittest.TestCase):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment