On Aug 14, 2006, at 8:40 PM, Ian Wilson wrote:
> ######IN project.validators######
>   class IntegrityValidator(FormValidator):
>     ...
>     def _to_python(self, value, state):
>       return value
>     def _from_python(self, value, state):
>       return value
>     def validate_python(self, value, state):
>       id = value['id']
>       name = value['name']
>       ...do something similar to what I did above to check  
> integrity...
>
>
>   class IntegritySchema(Schema):
>     chained_validators=[IntegrityValidator(...),]
>
> #######IN project.controllers########
>   form = widgets.TableForm(...., validator=IntegritySchema())
>
>
> I am trying something like that and getting this:
>
>     submit_text="Save", action="saveClothingProduct",
> validator=IntegritySchema())
>   File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/ 
> turbogears/widgets/meta.py",
> line 171, in widget_init
>     validator = generate_schema(self.validator, widgets)
>   File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/ 
> turbogears/widgets/meta.py",
> line 268, in generate_schema
>     schema = copy_schema(schema)
>   File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/ 
> turbogears/widgets/meta.py",
> line 213, in copy_schema
>     return copy.deepcopy(schema)
>   File "/usr/lib/python2.4/copy.py", line 204, in deepcopy
>     y = _reconstruct(x, rv, 1, memo)
>   File "/usr/lib/python2.4/copy.py", line 351, in _reconstruct
>     state = deepcopy(state, memo)
>   File "/usr/lib/python2.4/copy.py", line 174, in deepcopy
>     y = copier(x, memo)
>   File "/usr/lib/python2.4/copy.py", line 268, in _deepcopy_dict
>     y[deepcopy(key, memo)] = deepcopy(value, memo)
>   File "/usr/lib/python2.4/copy.py", line 174, in deepcopy
>     y = copier(x, memo)
>   File "/usr/lib/python2.4/copy.py", line 241, in _deepcopy_list
>     y.append(deepcopy(a, memo))
>   File "/usr/lib/python2.4/copy.py", line 204, in deepcopy
>     y = _reconstruct(x, rv, 1, memo)
>   File "/usr/lib/python2.4/copy.py", line 351, in _reconstruct
>     state = deepcopy(state, memo)
>   File "/usr/lib/python2.4/copy.py", line 174, in deepcopy
>     y = copier(x, memo)
>   File "/usr/lib/python2.4/copy.py", line 268, in _deepcopy_dict
>     y[deepcopy(key, memo)] = deepcopy(value, memo)
>   File "/usr/lib/python2.4/copy.py", line 174, in deepcopy
>     y = copier(x, memo)
>   File "/usr/lib/python2.4/copy.py", line 248, in _deepcopy_tuple
>     y.append(deepcopy(a, memo))
>   File "/usr/lib/python2.4/copy.py", line 204, in deepcopy
>     y = _reconstruct(x, rv, 1, memo)
>   File "/usr/lib/python2.4/copy.py", line 336, in _reconstruct
>     y = callable(*args)
>   File "/usr/lib/python2.4/copy_reg.py", line 92, in __newobj__
>     return cls.__new__(cls, *args)
> TypeError: instancemethod expected at least 2 arguments, got 0

Yepl, this is the correct approach to validate multiple form fields.  
However, you seem to have stomped on a bug or doing something wrong  
(I hope the later ;) ).

Can you please mail me privately the offendng validators to take a  
look at them?

Thanks,
Alberto

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to