From c5a751431807d1df015cd545d74e552ca507b533 Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Sun, 6 Feb 2011 20:07:03 -0500 Subject: [PATCH] Possibly breaking the usersubscription dupe checker, but its gotta work for both river and feed loads. --- apps/reader/managers.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/reader/managers.py b/apps/reader/managers.py index d39e85839..96e2c7175 100644 --- a/apps/reader/managers.py +++ b/apps/reader/managers.py @@ -7,9 +7,16 @@ class UserSubscriptionManager(models.Manager): try: return super(UserSubscriptionManager, self).get(*args, **kwargs) except: - dupe_feed = DuplicateFeed.objects.filter(duplicate_feed_id=kwargs['feed'].pk) + if 'feed' in kwargs: + feed_id = kwargs['feed'].pk + elif 'feed__pk' in kwargs: + feed_id = kwargs['feed__pk'] + dupe_feed = DuplicateFeed.objects.filter(duplicate_feed_id=feed_id) if dupe_feed: feed = dupe_feed[0].feed - kwargs['feed'] = feed - logging.debug(" ---> [%s] ~BRFound dupe UserSubscription: ~SB%s" % (kwargs['user'].username, kwargs['feed'])) + if 'feed' in kwargs: + kwargs['feed'] = feed + elif 'feed__pk' in kwargs: + kwargs['feed__pk'] = feed.pk + logging.debug(" ---> [%s] ~BRFound dupe UserSubscription: ~SB%s (%s)" % (kwargs['user'].username, feed, feed_id)) return super(UserSubscriptionManager, self).get(*args, **kwargs) \ No newline at end of file