[form] avoid spurious warning subsequent for form's action refactoring w/ autoforms
--- a/web/views/autoform.py Tue Jun 01 17:44:55 2010 +0200
+++ b/web/views/autoform.py Thu Jun 03 10:20:00 2010 +0200
@@ -650,13 +650,13 @@
# pre 3.8.3 compat
def set_action(self, action):
self._action = action
- @deprecated('[3.9] use form.form_action()')
def get_action(self):
try:
return self._action
except AttributeError:
return self._cw.build_url(self._default_form_action_path)
- action = property(get_action, set_action)
+ action = property(deprecated('[3.9] use form.form_action()')(get_action),
+ set_action)
@iclassmethod
def field_by_name(cls_or_self, name, role=None, eschema=None):
--- a/web/views/forms.py Tue Jun 01 17:44:55 2010 +0200
+++ b/web/views/forms.py Thu Jun 03 10:20:00 2010 +0200
@@ -196,9 +196,13 @@
_default_form_action_path = 'edit'
def form_action(self):
- if self.action is None:
+ try:
+ action = self.get_action() # avoid spurious warning w/ autoform bw compat property
+ except AttributeError:
+ action = self.action
+ if action is None:
return self._cw.build_url(self._default_form_action_path)
- return self.action
+ return action
@deprecated('[3.6] use .add_hidden(name, value, **kwargs)')
def form_add_hidden(self, name, value=None, **kwargs):