summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--forum/auth.py5
-rw-r--r--forum/models.py5
2 files changed, 8 insertions, 2 deletions
diff --git a/forum/auth.py b/forum/auth.py
index 36ca54d3..776746e8 100644
--- a/forum/auth.py
+++ b/forum/auth.py
@@ -167,7 +167,10 @@ def can_upload_files(request_user):
###########################################
def calculate_reputation(origin, offset):
result = int(origin) + int(offset)
- return result if result > 0 else 1
+ if (result > 0):
+ return result
+ else:
+ return 1
@transaction.commit_on_success
def onFlaggedItem(item, post, user):
diff --git a/forum/models.py b/forum/models.py
index 255eb21f..4d8894e4 100644
--- a/forum/models.py
+++ b/forum/models.py
@@ -652,7 +652,10 @@ def record_comment_event(instance, created, **kwargs):
from django.contrib.contenttypes.models import ContentType
question_type = ContentType.objects.get_for_model(Question)
question_type_id = question_type.id
- type = TYPE_ACTIVITY_COMMENT_QUESTION if instance.content_type_id == question_type_id else TYPE_ACTIVITY_COMMENT_ANSWER
+ if (instance.content_type_id == question_type_id):
+ type = TYPE_ACTIVITY_COMMENT_QUESTION
+ else:
+ type = TYPE_ACTIVITY_COMMENT_ANSWER
activity = Activity(user=instance.user, active_at=instance.added_at, content_object=instance, activity_type=type)
activity.save()