Permalink
Browse files

Merge branches 'master' and 'experimental'

  • Loading branch information...
2 parents f7eac8b + a4c7abc commit 6140720b3a4d2a4c00e425e4c23621b574109c35 Adolfo Fitoria committed Aug 5, 2009
Showing with 22 additions and 5 deletions.
  1. +4 −1 forum/auth.py
  2. +10 −2 forum/models.py
  3. +8 −2 forum/views.py
View
@@ -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):
View
@@ -173,7 +173,10 @@ def get_question_title(self):
attr = CONST['deleted']
else:
attr = None
- return u'%s %s' % (self.title, attr) if attr is not None else self.title
+ if (attr is not None):
+ return u'%s %s' % (self.title, attr)
+ else:
+ self.title
def get_revision_url(self):
return reverse('question_revisions', args=[self.id])
@@ -517,7 +520,12 @@ 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
+ #python 2.4 issues - Adolfo Fitoria
+ #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()
View
@@ -1037,8 +1037,14 @@ def __init__(self, time, type, title, summary, answer_id, question_id):
self.type_id = type
self.title = title
self.summary = summary
- self.title_link = u'/questions/%s/%s#%s' %(question_id, title, answer_id)\
- if int(answer_id) > 0 else u'/questions/%s/%s' %(question_id, title)
+ #python 2.4 issue - Adolfo Fitoria
+ #self.title_link = u'/questions/%s/%s#%s' %(question_id, title, answer_id)\
+ # if int(answer_id) > 0 else u'/questions/%s/%s' %(question_id, title)
+ if (int(answer_id)>0):
+ self.title_link = u'/questions/%s/%s#%s' %(question_id, title, answer_id)
+ else:
+ self.title_link = u'/questions/%s/%s' %(question_id, title)
+
class AwardEvent:
def __init__(self, time, type, id):
self.time = time

0 comments on commit 6140720

Please sign in to comment.