-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add deprecation indicator for URLs when using JSON format. #2
base: master
Are you sure you want to change the base?
Conversation
My plan is to make a tag from this rather than to merge it to master since it's based on 3.0.2. At least I think that makes sense? |
4fc5a89
to
b712745
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this be something that we need to redo or maintain if we upgrade django in the future?
@@ -121,7 +121,12 @@ def handle(self, *args, **options): | |||
raise CommandError("Error occurred while trying to load %s: %s" % (getattr(settings, urlconf), str(e))) | |||
|
|||
view_functions = self.extract_views_from_urlpatterns(urlconf.urlpatterns) | |||
for (func, regex, url_name) in view_functions: | |||
for (func, regex, url_name, *deprecated) in view_functions: | |||
if deprecated: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks odd... Is deprecated sometimes a bool and sometimes a list? If so it is better to check the type than a boolean check. Best would be if it is always same type though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, no... The problem is that I've re-used the name. I'll rename some of them to make it clearer.
dedb1ed
to
4ef7af2
Compare
@@ -203,6 +208,7 @@ def extract_views_from_urlpatterns(self, urlpatterns, base='', namespace=None): | |||
""" | |||
views = [] | |||
for p in urlpatterns: | |||
deprecated = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This value has two defaults. this is 1
@@ -211,8 +217,12 @@ def extract_views_from_urlpatterns(self, urlpatterns, base='', namespace=None): | |||
name = '{0}:{1}'.format(namespace, p.name) | |||
else: | |||
name = p.name | |||
deprecated = getattr(p, "deprecated", False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This value has two defaults. this is 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. That's what I get for refactoring :)
Possibly, but this is a third party library and not part of the main django installation. Before this, we didn't even install it in our environment. As long as the "show_urls" part of django-extensions is still compatible with our django installation, we'll have no problems and I don't think that will happen extremely often. Plus, this change is small so it's pretty easy to just grab the latest compatible django-extensions and add it back in. However, Peter suggested that I send this upstream in a PR and ask if they'd be interested in adding it so we don't have to bother in the future. |
4ef7af2
to
1307e7c
Compare
Based on release 3.0.2 rather than on HEAD.