diff options
-rw-r--r-- | forum/management/commands/clean_award_badges.py | 7 | ||||
-rw-r--r-- | forum/management/commands/multi_award_badges.py | 45 | ||||
-rw-r--r-- | forum/management/commands/once_award_badges.py | 23 | ||||
-rw-r--r-- | forum/management/commands/send_email_alerts.py | 7 | ||||
-rw-r--r-- | forum/management/commands/subscribe_everyone.py | 7 |
5 files changed, 47 insertions, 42 deletions
diff --git a/forum/management/commands/clean_award_badges.py b/forum/management/commands/clean_award_badges.py index df3d2917..117e3a5f 100644 --- a/forum/management/commands/clean_award_badges.py +++ b/forum/management/commands/clean_award_badges.py @@ -21,9 +21,10 @@ from forum.models import * class Command(NoArgsCommand): def handle_noargs(self, **options): try: - self.clean_awards() - except Exception, e: - print e + try: + self.clean_awards() + except Exception, e: + print e finally: connection.close() diff --git a/forum/management/commands/multi_award_badges.py b/forum/management/commands/multi_award_badges.py index 723a8cec..c6dbc250 100644 --- a/forum/management/commands/multi_award_badges.py +++ b/forum/management/commands/multi_award_badges.py @@ -82,27 +82,28 @@ TYPE_ACTIVITY_USER_FULL_UPDATED = 17 class Command(BaseCommand): def handle_noargs(self, **options): try: - self.delete_question_be_voted_up_3() - self.delete_answer_be_voted_up_3() - self.delete_question_be_vote_down_3() - self.delete_answer_be_voted_down_3() - self.answer_be_voted_up_10() - self.question_be_voted_up_10() - self.question_view_1000() - self.answer_self_question_be_voted_up_3() - self.answer_be_voted_up_100() - self.question_be_voted_up_100() - self.question_be_favorited_100() - self.question_view_10000() - self.answer_be_voted_up_25() - self.question_be_voted_up_25() - self.question_be_favorited_25() - self.question_view_2500() - self.answer_be_accepted_and_voted_up_40() - self.question_be_answered_after_60_days_and_be_voted_up_5() - self.created_tag_be_used_in_question_50() - except Exception, e: - print e + try: + self.delete_question_be_voted_up_3() + self.delete_answer_be_voted_up_3() + self.delete_question_be_vote_down_3() + self.delete_answer_be_voted_down_3() + self.answer_be_voted_up_10() + self.question_be_voted_up_10() + self.question_view_1000() + self.answer_self_question_be_voted_up_3() + self.answer_be_voted_up_100() + self.question_be_voted_up_100() + self.question_be_favorited_100() + self.question_view_10000() + self.answer_be_voted_up_25() + self.question_be_voted_up_25() + self.question_be_favorited_25() + self.question_view_2500() + self.answer_be_accepted_and_voted_up_40() + self.question_be_answered_after_60_days_and_be_voted_up_5() + self.created_tag_be_used_in_question_50() + except Exception, e: + print e finally: connection.close() @@ -317,7 +318,7 @@ class Command(BaseCommand): object_id = row[2] user = get_object_or_404(User, id=user_id) - award = Award(user=user, badge=badge, content_type=content_type, object_id=objet_id) + award = Award(user=user, badge=badge, content_type=content_type, object_id=object_id) award.save() if update_auditted: diff --git a/forum/management/commands/once_award_badges.py b/forum/management/commands/once_award_badges.py index 03982c79..8c913348 100644 --- a/forum/management/commands/once_award_badges.py +++ b/forum/management/commands/once_award_badges.py @@ -94,17 +94,18 @@ BADGE_AWARD_TYPE_FIRST = { class Command(BaseCommand): def handle_noargs(self, **options): try: - self.alpha_user() - self.beta_user() - self.first_type_award() - self.first_ask_be_voted() - self.first_answer_be_voted() - self.first_answer_be_voted_10() - self.vote_count_300() - self.edit_count_100() - self.comment_count_10() - except Exception, e: - print e + try: + self.alpha_user() + self.beta_user() + self.first_type_award() + self.first_ask_be_voted() + self.first_answer_be_voted() + self.first_answer_be_voted_10() + self.vote_count_300() + self.edit_count_100() + self.comment_count_10() + except Exception, e: + print e finally: connection.close() diff --git a/forum/management/commands/send_email_alerts.py b/forum/management/commands/send_email_alerts.py index 777381ec..f5974e6b 100644 --- a/forum/management/commands/send_email_alerts.py +++ b/forum/management/commands/send_email_alerts.py @@ -14,9 +14,10 @@ from utils.odict import OrderedDict class Command(NoArgsCommand): def handle_noargs(self,**options): try: - self.send_email_alerts() - except Exception, e: - print e + try: + self.send_email_alerts() + except Exception, e: + print e finally: connection.close() diff --git a/forum/management/commands/subscribe_everyone.py b/forum/management/commands/subscribe_everyone.py index 3f8da9ec..f5cbf8eb 100644 --- a/forum/management/commands/subscribe_everyone.py +++ b/forum/management/commands/subscribe_everyone.py @@ -11,9 +11,10 @@ import settings class Command(NoArgsCommand): def handle_noargs(self,**options): try: - self.subscribe_everyone() - except Exception, e: - print e + try: + self.subscribe_everyone() + except Exception, e: + print e finally: connection.close() |