Rename add_error methods: Django 1.7 conflict
In Django 1.7, Forms have an add_error() method and our definition
was conflicting with Django's method. Thanks to hertzog@debian.org
for the patch.
Note that it is required to support Django 1.7 in Icehouse, because
we're planning to release Debian Jessie with both Django 1.7 and
Icehouse. This is to *support* Django 1.7, not at all to *switch* to
it, which is very different.
Close-bug: #1352919
Change-Id: I1f558cf7f3198a68629738a011e9cae0c3749320
(cherry picked from commit 04dd1568c1
)
This commit is contained in:
parent
2b9c566952
commit
ad2d4281a3
@ -164,7 +164,7 @@ class Action(forms.Form):
|
|||||||
text += linebreaks(force_unicode(self.help_text))
|
text += linebreaks(force_unicode(self.help_text))
|
||||||
return safe(text)
|
return safe(text)
|
||||||
|
|
||||||
def add_error(self, message):
|
def add_action_error(self, message):
|
||||||
"""Adds an error to the Action's Step based on API issues."""
|
"""Adds an error to the Action's Step based on API issues."""
|
||||||
self.errors[NON_FIELD_ERRORS] = self.error_class([message])
|
self.errors[NON_FIELD_ERRORS] = self.error_class([message])
|
||||||
|
|
||||||
@ -432,9 +432,9 @@ class Step(object):
|
|||||||
text += self.action.get_help_text()
|
text += self.action.get_help_text()
|
||||||
return safe(text)
|
return safe(text)
|
||||||
|
|
||||||
def add_error(self, message):
|
def add_step_error(self, message):
|
||||||
"""Adds an error to the Step based on API issues."""
|
"""Adds an error to the Step based on API issues."""
|
||||||
self.action.add_error(message)
|
self.action.add_action_error(message)
|
||||||
|
|
||||||
def has_required_fields(self):
|
def has_required_fields(self):
|
||||||
"""Returns True if action contains any required fields."""
|
"""Returns True if action contains any required fields."""
|
||||||
@ -863,4 +863,4 @@ class Workflow(html.HTMLElement):
|
|||||||
"""
|
"""
|
||||||
step = self.get_step(slug)
|
step = self.get_step(slug)
|
||||||
if step:
|
if step:
|
||||||
step.add_error(message)
|
step.add_step_error(message)
|
||||||
|
Loading…
Reference in New Issue
Block a user