#24220: get_success_url raises an exception when success_url is lazy object
-------------------------------+-----------------------
Reporter: tricoder42 | Owner: nobody
Type: Bug | Status: new
Component: Generic views | Version: 1.8alpha1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+-----------------------
In #24133 was added deprecation warning when `self.success_url` contains
old %-style Python formatting strings.
However, `success_url` could be a lazy object like `reverse_lazy` and
trying to call `re.search` on lazy object results in `TypeError`:
{{{
../../../../.envs/lingui-next/lib/python3.4/site-
packages/django/views/generic/edit.py:166: in get_success_url
if re.search(r'%\([^\)]+\)', self.success_url):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _
pattern = '%\\([^\\)]+\\)'
string = <django.utils.functional.lazy.<locals>.__proxy__ object at
0x10678ca90>
flags = 0
def search(pattern, string, flags=0):
"""Scan through string looking for a match to the pattern,
returning
a match object, or None if no match was found."""
> return _compile(pattern, flags).search(string)
E TypeError: expected string or buffer
../../../../.envs/lingui-next/lib/python3.4/re.py:166: TypeError
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24220>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.8bd9dadd98253d62843551b9e346d648%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.