From a084c0a71fd69ac57740eb8411df9499e6458915 Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Sun, 9 Aug 2009 17:41:57 -0600 Subject: fixing more python 2.4 compat issues (hope it will be the last ones) --- forum/auth.py | 5 ++++- forum/models.py | 5 ++++- 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() -- cgit v1.2.3-1-g7c22