Silence deprecation warnings
https://docs.djangoproject.com/en/1.11/releases/1.10/#using-user-is-authenticated-and-user-is-anonymous-as-methods
This commit is contained in:
@@ -728,7 +728,7 @@ class FieldDataCache(object):
|
||||
"""
|
||||
Add all `descriptors` to this FieldDataCache.
|
||||
"""
|
||||
if self.user.is_authenticated():
|
||||
if self.user.is_authenticated:
|
||||
self.scorable_locations.update(desc.location for desc in descriptors if desc.has_score)
|
||||
for scope, fields in self._fields_to_cache(descriptors).items():
|
||||
if scope not in self.cache:
|
||||
@@ -815,7 +815,7 @@ class FieldDataCache(object):
|
||||
Raises: KeyError if key isn't found in the cache
|
||||
"""
|
||||
|
||||
if key.scope.user == UserScope.ONE and not self.user.is_anonymous():
|
||||
if key.scope.user == UserScope.ONE and not self.user.is_anonymous:
|
||||
# If we're getting user data, we expect that the key matches the
|
||||
# user we were constructed for.
|
||||
assert key.user_id == self.user.id
|
||||
@@ -842,7 +842,7 @@ class FieldDataCache(object):
|
||||
by_scope = defaultdict(dict)
|
||||
for key, value in kv_dict.iteritems():
|
||||
|
||||
if key.scope.user == UserScope.ONE and not self.user.is_anonymous():
|
||||
if key.scope.user == UserScope.ONE and not self.user.is_anonymous:
|
||||
# If we're getting user data, we expect that the key matches the
|
||||
# user we were constructed for.
|
||||
assert key.user_id == self.user.id
|
||||
@@ -875,7 +875,7 @@ class FieldDataCache(object):
|
||||
if self.read_only:
|
||||
return
|
||||
|
||||
if key.scope.user == UserScope.ONE and not self.user.is_anonymous():
|
||||
if key.scope.user == UserScope.ONE and not self.user.is_anonymous:
|
||||
# If we're getting user data, we expect that the key matches the
|
||||
# user we were constructed for.
|
||||
assert key.user_id == self.user.id
|
||||
@@ -896,7 +896,7 @@ class FieldDataCache(object):
|
||||
Returns: bool
|
||||
"""
|
||||
|
||||
if key.scope.user == UserScope.ONE and not self.user.is_anonymous():
|
||||
if key.scope.user == UserScope.ONE and not self.user.is_anonymous:
|
||||
# If we're getting user data, we expect that the key matches the
|
||||
# user we were constructed for.
|
||||
assert key.user_id == self.user.id
|
||||
@@ -916,7 +916,7 @@ class FieldDataCache(object):
|
||||
|
||||
Returns: datetime if there was a modified date, or None otherwise
|
||||
"""
|
||||
if key.scope.user == UserScope.ONE and not self.user.is_anonymous():
|
||||
if key.scope.user == UserScope.ONE and not self.user.is_anonymous:
|
||||
# If we're getting user data, we expect that the key matches the
|
||||
# user we were constructed for.
|
||||
assert key.user_id == self.user.id
|
||||
|
||||
Reference in New Issue
Block a user