Permalink
Browse files

Fixing about 4 bugs that have to do with logging, activating broken p…

…remiums, and importing from google reader when the user already has feeds and they aren't being cleared out (broken since friday july 20th, a week ago). Thanks to Luke Dieker for the find.
  • Loading branch information...
1 parent 22582e1 commit 2657d714b8b48bf315fafaadea412a6221942107 @samuelclay committed Jul 27, 2012
Showing with 10 additions and 4 deletions.
  1. +2 −0 apps/feed_import/models.py
  2. +6 −2 apps/profile/models.py
  3. +1 −1 utils/mongo_raw_log_middleware.py
  4. +1 −1 utils/redis_raw_log_middleware.py
@@ -241,6 +241,8 @@ def process_feeds(self, feeds_xml):
folders = self.rearrange_folders(folders)
logging.user(self.user, "~BB~FW~SBGoogle Reader import: ~BT~FW%s" % (self.subscription_folders))
+
+ self.clear_folders()
UserSubscriptionFolders.objects.get_or_create(user=self.user, defaults=dict(
folders=json.encode(self.subscription_folders)))
View
@@ -260,8 +260,12 @@ def paypal_signup(sender, **kwargs):
subscription_signup.connect(paypal_signup)
def stripe_signup(sender, full_json, **kwargs):
- profile = Profile.objects.get(stripe_id=full_json['data']['object']['customer'])
- profile.activate_premium()
+ stripe_id = full_json['data']['object']['customer']
+ try:
+ profile = Profile.objects.get(stripe_id=stripe_id)
+ profile.activate_premium()
+ except Profile.DoesNotExist:
+ return {"code": -1, "message": "User doesn't exist."}
zebra_webhook_customer_subscription_created.connect(stripe_signup)
def change_password(user, old_password, new_password):
@@ -28,7 +28,7 @@ def process_view(self, request, callback, callback_args, callback_kwargs):
return None
def process_response(self, request, response):
- if settings.DEBUG:
+ if settings.DEBUG and hasattr(self, 'orig_send_message') and hasattr(self, 'orig_send_message_with_response'):
# remove instrumentation from pymongo
Connection._send_message = \
self.orig_send_message
@@ -20,7 +20,7 @@ def process_view(self, request, callback, callback_args, callback_kwargs):
return None
def process_response(self, request, response):
- if settings.DEBUG:
+ if settings.DEBUG and hasattr(self, 'orig_pack_command'):
# remove instrumentation from redis
Connection.pack_command = \
self.orig_pack_command

0 comments on commit 2657d71

Please sign in to comment.