Skip to content

Commit 4d1d3ab

Browse files
committed
Remove unused resolve_url
1 parent a1068a0 commit 4d1d3ab

File tree

1 file changed

+0
-43
lines changed

1 file changed

+0
-43
lines changed

plain-passwords/plain/passwords/views.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
from plain.http import (
55
ResponseRedirect,
66
)
7-
from plain.urls import NoReverseMatch, reverse
8-
from plain.utils.functional import Promise
97
from plain.views import CreateView, FormView
108

119
from .forms import (
@@ -17,47 +15,6 @@
1715
)
1816

1917

20-
def resolve_url(to, *args, **kwargs):
21-
"""
22-
Return a URL appropriate for the arguments passed.
23-
24-
The arguments could be:
25-
26-
* A model: the model's `get_absolute_url()` function will be called.
27-
28-
* A view name, possibly with arguments: `urls.reverse()` will be used
29-
to reverse-resolve the name.
30-
31-
* A URL, which will be returned as-is.
32-
"""
33-
# If it's a model, use get_absolute_url()
34-
if hasattr(to, "get_absolute_url"):
35-
return to.get_absolute_url()
36-
37-
if isinstance(to, Promise):
38-
# Expand the lazy instance, as it can cause issues when it is passed
39-
# further to some Python functions like urlparse.
40-
to = str(to)
41-
42-
# Handle relative URLs
43-
if isinstance(to, str) and to.startswith(("./", "../")):
44-
return to
45-
46-
# Next try a reverse URL resolution.
47-
try:
48-
return reverse(to, args=args, kwargs=kwargs)
49-
except NoReverseMatch:
50-
# If this is a callable, re-raise.
51-
if callable(to):
52-
raise
53-
# If this doesn't "feel" like a URL, re-raise.
54-
if "/" not in to and "." not in to:
55-
raise
56-
57-
# Finally, fall back and assume it's a URL
58-
return to
59-
60-
6118
def update_session_auth_hash(request, user):
6219
"""
6320
Updating a user's password logs out all sessions for the user.

0 commit comments

Comments
 (0)