254 |
254 |
255 def __init__(self, req, rset=None, row=None, col=None, submitmsg=None, |
255 def __init__(self, req, rset=None, row=None, col=None, submitmsg=None, |
256 **kwargs): |
256 **kwargs): |
257 super(FieldsForm, self).__init__(req, rset, row=row, col=col) |
257 super(FieldsForm, self).__init__(req, rset, row=row, col=col) |
258 for key, val in kwargs.items(): |
258 for key, val in kwargs.items(): |
259 assert hasattr(self.__class__, key) and not key[0] == '_', key |
259 if key in NAV_FORM_PARAMETERS: |
260 setattr(self, key, val) |
260 self.form_add_hidden(key, val) |
|
261 else: |
|
262 assert hasattr(self.__class__, key) and not key[0] == '_', key |
|
263 setattr(self, key, val) |
261 self.fields = list(self.__class__._fields_) |
264 self.fields = list(self.__class__._fields_) |
262 if self.set_error_url: |
265 if self.set_error_url: |
263 self.form_add_hidden('__errorurl', req.url()) |
266 self.form_add_hidden('__errorurl', req.url()) |
264 if self.copy_nav_params: |
267 if self.copy_nav_params: |
265 for param in NAV_FORM_PARAMETERS: |
268 for param in NAV_FORM_PARAMETERS: |
266 value = kwargs.get(param, req.form.get(param)) |
269 if not param in kwargs: |
267 if value: |
270 value = req.form.get(param) |
268 self.form_add_hidden(param, value) |
271 if value: |
|
272 self.form_add_hidden(param, value) |
269 if submitmsg is not None: |
273 if submitmsg is not None: |
270 self.form_add_hidden('__message', submitmsg) |
274 self.form_add_hidden('__message', submitmsg) |
271 self.context = None |
275 self.context = None |
272 |
276 |
273 @iclassmethod |
277 @iclassmethod |