-
Notifications
You must be signed in to change notification settings - Fork 134
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
Migration Django 2.0 #239
Migration Django 2.0 #239
Conversation
Updated models.py to support Django 2.0
replaced django.core.urlresolvers with django.urls
Thank you. |
this adds compatibility with django prior to 1.10
replaced django.conf.urls with django.core.urlresolvers.
Thank you. |
…new ManytoMany interface
@@ -63,6 +63,9 @@ def handle(self, *apps, **options): | |||
item.save(using=using) | |||
# Copy permissions to M2M field once `item` | |||
# has been saved | |||
item.access_permissions = item.permissions | |||
if hasattr(item.access_permissions, "set"): |
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.
Here and in other cases please use single quotes '
for string literals to not to contradict overall style and reduce visual noise.
sitetree/sitetreeapp.py
Outdated
@@ -608,7 +608,13 @@ def get_tree_current_item(self, tree_alias): | |||
return None | |||
|
|||
# urlquote is an attempt to support non-ascii in url. | |||
current_url = urlquote(self.current_request.path) | |||
path = self.current_request.path | |||
if type(path) == str: |
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.
Here isinstance
should be used.
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 branching will cost us something, bearing in mind it's a busy method. To reduce the cost we should try to pick conversion we need (if we really need it) on import time (e.g. partial
or something).
sitetree/sitetreeapp.py
Outdated
current_url = urlquote(path.encode("UTF-8")) | ||
elif type(path) in (bytes, bytearray): | ||
current_url = urlquote(path) | ||
else: |
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.
What type do mean?
sitetree/sitetreeapp.py
Outdated
@@ -851,7 +857,10 @@ def check_access(self, item, context): | |||
:param Context context: | |||
:rtype: bool | |||
""" | |||
authenticated = self.current_request.user.is_authenticated() | |||
if hasattr(self.current_request.user.is_authenticated, "__call__"): |
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.
It seems that this logic can also be moved onto module import stage.
Thank you! Merged. |
These commits should add an basic compatibility with django 2.0a1