python3/django3 upgrades

This commit is contained in:
Jonathan Math 2020-11-07 10:46:41 +07:00
parent fc7eaa95a0
commit 83048ce0ca
4 changed files with 4 additions and 5 deletions

View file

@ -1,7 +1,7 @@
from utils import json_functions as json
from django.test.client import Client
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.conf import settings
from mongoengine.connection import connect, disconnect

View file

@ -30,8 +30,7 @@ class PushSubscriptionManager(models.Manager):
if lease_seconds is None:
lease_seconds = getattr(settings, 'PUBSUBHUBBUB_LEASE_SECONDS',
DEFAULT_LEASE_SECONDS)
feed = Feed.get_by_id(feed.pk)
feed = Feed.get_by_id(feed.id)
subscription, created = self.get_or_create(feed=feed)
signals.pre_subscribe.send(sender=subscription, created=created)
subscription.set_expiration(lease_seconds)

View file

@ -147,7 +147,7 @@ class PSHBSubscriptionManagerTest(PSHBTestBase, TestCase):
self.responses.append(MockResponse(500, 'error data'))
try:
PushSubscription.objects.subscribe('topic', 'hub', 'callback')
except urllib.URLError as e:
except urllib.error.URLError as e:
self.assertEquals(e.reason,
'error subscribing to topic on hub:\nerror data')
else:

View file

@ -33,4 +33,4 @@ class UserSubscriptionManager(models.Manager):
return super(UserSubscriptionManager, self).get(*args, **kwargs)
else:
exc_info = sys.exc_info()
raise exc_info[0].with_traceback(exc_info[2])
raise exc_info[1]