#24220 closed Bug (fixed)
get_success_url raises an exception when success_url is lazy object
Reported by: | Tomáš Ehrlich | Owned by: | Tomáš Ehrlich |
---|---|---|---|
Component: | Generic views | Version: | 1.8alpha1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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
Change History (4)
comment:1 by , 10 years ago
Has patch: | set |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:3 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
Added PR https://github.com/django/django/pull/3989