BOM-1111
Updating User.is_authenticated and User.is_anonymous as properties
This commit is contained in:
@@ -20,7 +20,7 @@ def get_student_module_as_dict(user, course_key, block_key):
|
||||
Returns:
|
||||
StudentModule as a (possibly empty) dict.
|
||||
"""
|
||||
if not user.is_authenticated():
|
||||
if not user.is_authenticated:
|
||||
return {}
|
||||
|
||||
try:
|
||||
|
||||
@@ -168,7 +168,7 @@ class StudentModule(models.Model):
|
||||
|
||||
@classmethod
|
||||
def save_state(cls, student, course_id, module_state_key, defaults):
|
||||
if not student.is_authenticated():
|
||||
if not student.is_authenticated:
|
||||
return
|
||||
else:
|
||||
cls.objects.update_or_create(
|
||||
|
||||
@@ -579,7 +579,7 @@ def get_module_system_for_user(
|
||||
"""
|
||||
Submit a grade for the block.
|
||||
"""
|
||||
if not user.is_anonymous():
|
||||
if not user.is_anonymous:
|
||||
grades_signals.SCORE_PUBLISHED.send(
|
||||
sender=None,
|
||||
block=block,
|
||||
|
||||
@@ -274,7 +274,7 @@ def get_experiment_user_metadata_context(course, user):
|
||||
pass # Not enrolled, use the default values
|
||||
|
||||
has_entitlements = False
|
||||
if user.is_authenticated():
|
||||
if user.is_authenticated:
|
||||
has_entitlements = CourseEntitlement.objects.filter(user=user).exists()
|
||||
|
||||
context = get_base_experiment_metadata_context(course, user, enrollment, user_enrollments)
|
||||
@@ -284,7 +284,7 @@ def get_experiment_user_metadata_context(course, user):
|
||||
forum_roles = list(Role.objects.filter(users=user, course_id=course.id).values_list('name').distinct())
|
||||
|
||||
# get user partition data
|
||||
if user.is_authenticated():
|
||||
if user.is_authenticated:
|
||||
partition_groups = get_all_partitions_for_course(course)
|
||||
user_partitions = get_user_partition_groups(course.id, partition_groups, user, 'name')
|
||||
else:
|
||||
|
||||
@@ -165,7 +165,7 @@ class XBlockRuntime(RuntimeShim, Runtime):
|
||||
"""
|
||||
Submit a grade for the block.
|
||||
"""
|
||||
if not self.user.is_anonymous():
|
||||
if not self.user.is_anonymous:
|
||||
grades_signals.SCORE_PUBLISHED.send(
|
||||
sender=None,
|
||||
block=block,
|
||||
|
||||
Reference in New Issue
Block a user