last 2.0 deprecations

pull/95/head
eric 2018-07-24 11:33:39 -04:00
parent d86912a61d
commit 26bab0af68
28 changed files with 49 additions and 53 deletions

View File

@ -3,7 +3,7 @@ from itertools import islice
from lxml import etree
import datetime
import urlparse
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.utils.http import urlquote
import pytz

View File

@ -2,7 +2,7 @@ from itertools import islice
import datetime
import urlparse
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.utils.http import urlquote
import json
import pytz

View File

@ -10,7 +10,7 @@ from tastypie.exceptions import BadRequest
from django.conf.urls import url
from django.contrib import auth
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.urls import reverse
from regluit.core import models
import regluit.core.isbn

View File

@ -6,7 +6,7 @@ import logging
from django.contrib import auth
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.shortcuts import render, render_to_response
from django.template import RequestContext
from django.views.decorators.csrf import csrf_exempt

View File

@ -22,7 +22,7 @@ class Migration(migrations.Migration):
('rght', models.PositiveIntegerField(editable=False, db_index=True)),
('tree_id', models.PositiveIntegerField(editable=False, db_index=True)),
('level', models.PositiveIntegerField(editable=False, db_index=True)),
('parent', mptt.fields.TreeForeignKey(related_name='children', blank=True, to='bisac.BisacHeading', null=True)),
('parent', mptt.fields.TreeForeignKey(on_delete=models.CASCADE, related_name='children', blank=True, to='bisac.BisacHeading', null=True)),
],
options={
'abstract': False,

View File

@ -6,7 +6,7 @@ class BisacHeading(MPTTModel):
full_label = models.CharField(max_length=100, unique=True)
label = models.CharField(max_length=60, unique=False)
notation = models.CharField(max_length=9, unique=False)
parent = TreeForeignKey('self', null=True, blank=True, related_name='children', db_index=True)
parent = TreeForeignKey('self', on_delete=models.CASCADE, null=True, blank=True, related_name='children', db_index=True)
class MPTTMeta:
order_insertion_by = ['notation']

View File

@ -3,7 +3,7 @@
#
from django import forms
from django.contrib.admin import ModelAdmin, register
from django.core.urlresolvers import reverse
from django.urls import reverse
from selectable.forms import (
AutoCompleteSelectWidget,

View File

@ -22,7 +22,7 @@ from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.contrib.contenttypes.fields import GenericRelation
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.core.files.base import ContentFile
from django.db import models
from django.db.models import F, Q
@ -442,7 +442,7 @@ class Campaign(models.Model):
self.activated = None
self.update_left()
self.save()
self.managers = old_managers
self.managers.set(old_managers)
# clone associated premiums
for premium in new_premiums:
@ -1117,7 +1117,7 @@ class Wishlist(models.Model):
class Wishes(models.Model):
created = models.DateTimeField(auto_now_add=True, db_index=True,)
source = models.CharField(max_length=15, blank=True, db_index=True,)
wishlist = models.ForeignKey('Wishlist')
wishlist = models.ForeignKey('Wishlist', on_delete=models.CASCADE)
work = models.ForeignKey('Work', on_delete=models.CASCADE, related_name='wishes')
class Meta:
db_table = 'core_wishlist_works'

View File

@ -16,7 +16,7 @@ from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import GenericRelation
from django.core.files.base import ContentFile
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.db import models
from django.db.models import F
from django.db.models.signals import post_save, pre_delete
@ -767,7 +767,7 @@ class Relation(models.Model):
class Relator(models.Model):
relation = models.ForeignKey('Relation', on_delete=models.CASCADE, default=1) #first relation should have code='aut'
author = models.ForeignKey('Author')
author = models.ForeignKey('Author', on_delete=models.CASCADE)
edition = models.ForeignKey('Edition', on_delete=models.CASCADE, related_name='relators')
class Meta:
db_table = 'core_author_editions'
@ -1060,7 +1060,7 @@ class PublisherName(models.Model):
class WasWork(models.Model):
work = models.ForeignKey('Work')
work = models.ForeignKey('Work', on_delete=models.CASCADE)
was = models.IntegerField(unique=True)
moved = models.DateTimeField(auto_now_add=True)
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, null=True)

View File

@ -1,5 +1,5 @@
from django.contrib.sitemaps import Sitemap
from django.core.urlresolvers import reverse
from django.urls import reverse
from regluit.core.models import Work, Edition
class WorkSitemap(Sitemap):

View File

@ -12,8 +12,7 @@ from decimal import Decimal as D
from django import forms
from django.conf import settings
from django.contrib.auth.models import User
from django.forms.widgets import RadioSelect
from django.forms.extras.widgets import SelectDateWidget
from django.forms.widgets import RadioSelect, SelectDateWidget
from django.utils.translation import ugettext_lazy as _
from selectable.forms import (

View File

@ -10,8 +10,7 @@ from selectable.forms import (
from django import forms
from django.conf import settings
from django.forms.extras.widgets import SelectDateWidget
from django.forms.widgets import RadioSelect
from django.forms.widgets import RadioSelect, SelectDateWidget
from django.utils.translation import ugettext_lazy as _
from django.utils.timezone import now

View File

@ -10,7 +10,7 @@ from decimal import Decimal as D
from django.contrib import auth
from django.contrib.auth.models import User
from django.core import mail
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.test import TestCase
from django.test.client import Client
from django.utils.timezone import now

View File

@ -29,7 +29,7 @@ from django.core import signing
from django.core.exceptions import ValidationError
from django.core.files.storage import default_storage
from django.core.mail import EmailMessage
from django.core.urlresolvers import reverse, reverse_lazy
from django.urls import reverse, reverse_lazy
from django.core.validators import validate_email
from django.db.models import Q, Count, Sum
from django.forms import Select

View File

@ -3,7 +3,7 @@ views to edit bibmodels
'''
from django.contrib.auth.decorators import login_required
from django.core.files.storage import default_storage
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.db.models import Q
from django.http import (
HttpResponseRedirect,

View File

@ -3,7 +3,7 @@ from decimal import Decimal as D
import logging
from django.conf import settings
from django.core.urlresolvers import reverse, reverse_lazy
from django.urls import reverse, reverse_lazy
from django.forms.models import modelformset_factory
from django.http import HttpResponseRedirect, Http404
from django.shortcuts import render, get_object_or_404

View File

@ -10,14 +10,14 @@ from django.db.models import Q
from django.db.models.signals import post_save
from django.forms import GenericIPAddressField as BaseIPAddressField
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from django.urls import reverse
class Library(models.Model):
'''
name and other things derive from the User
'''
user = models.OneToOneField(settings.AUTH_USER_MODEL, related_name='library')
group = models.OneToOneField(Group, related_name='library', null = True)
user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='library')
group = models.OneToOneField(Group, on_delete=models.CASCADE, related_name='library', null = True)
backend = models.CharField(max_length=10, choices=(
('ip','IP authentication'),
('cardnum', 'Library Card Number check'),

View File

@ -1,5 +1,5 @@
import unittest
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.test import TestCase
from django.contrib.auth.models import User
@ -30,11 +30,11 @@ class TestLibraryAuth(TestCase):
new_user = User.objects.get(username='bob')
self.failUnless(new_user.check_password('secret'))
self.assertTrue(new_user.check_password('secret'))
self.assertEqual(new_user.email, 'bob@example.com')
# New user must not be active.
self.failIf(new_user.is_active)
self.assertFalse(new_user.is_active)
def test_bad_registration(self):
"""

View File

@ -1,5 +1,5 @@
from django.conf.urls import url, include
from django.core.urlresolvers import reverse_lazy
from django.urls import reverse_lazy
from django.views.generic.base import TemplateView
from django.contrib.auth.decorators import login_required
from django.contrib.auth.views import password_reset

View File

@ -1,7 +1,7 @@
import logging
import random
from django.conf import settings
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.shortcuts import get_object_or_404, render
from django.contrib.auth.forms import SetPasswordForm
from django.contrib.auth.views import login, password_reset, password_change

View File

@ -11,7 +11,7 @@ from datetime import datetime
from StringIO import StringIO
from django.conf import settings
from django.core.urlresolvers import reverse
from django.urls import reverse
import regluit.core.cc as cc

View File

@ -3,7 +3,7 @@ from xml.sax import SAXParseException
from django.apps import apps
from django.contrib import messages
from django.core.urlresolvers import reverse, reverse_lazy
from django.urls import reverse, reverse_lazy
from django.http import HttpResponseRedirect, HttpResponse, HttpResponseNotFound
from django.views.generic.edit import FormView

View File

@ -17,7 +17,7 @@ django imports
"""
from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.utils.timezone import now
"""

View File

@ -421,7 +421,7 @@ class StripeErrorTest(TestCase):
self.fail("Attempt to create customer did not throw expected exception.")
except stripe.CardError as e:
self.assertEqual(e.code, "card_declined")
self.assertEqual(e.message, "Your card was declined")
self.assertEqual(e.args[0], "Your card was declined")
def test_charge_bad_cust(self):
# expect the card to be declined -- and for us to get CardError
@ -450,7 +450,7 @@ class StripeErrorTest(TestCase):
self.fail("Attempt to create token with bad cc number did not throw expected exception.")
except stripe.CardError as e:
self.assertEqual(e.code, "incorrect_number")
self.assertEqual(e.message, "Your card number is incorrect")
self.assertEqual(e.args[0], "Your card number is incorrect")
def test_invalid_expiry_month(self):
"""Use an invalid month e.g. 13."""
@ -464,7 +464,7 @@ class StripeErrorTest(TestCase):
self.fail("Attempt to create token with invalid expiry month did not throw expected exception.")
except stripe.CardError as e:
self.assertEqual(e.code, "invalid_expiry_month")
self.assertEqual(e.message, "Your card's expiration month is invalid")
self.assertEqual(e.args[0], "Your card's expiration month is invalid")
def test_invalid_expiry_year(self):
"""Use a year in the past e.g. 1970."""
@ -478,7 +478,7 @@ class StripeErrorTest(TestCase):
self.fail("Attempt to create token with invalid expiry year did not throw expected exception.")
except stripe.CardError as e:
self.assertEqual(e.code, "invalid_expiry_year")
self.assertEqual(e.message, "Your card's expiration year is invalid")
self.assertEqual(e.args[0], "Your card's expiration year is invalid")
def test_invalid_cvc(self):
"""Use a two digit number e.g. 99."""
@ -492,7 +492,7 @@ class StripeErrorTest(TestCase):
self.fail("Attempt to create token with invalid cvc did not throw expected exception.")
except stripe.CardError as e:
self.assertEqual(e.code, "invalid_cvc")
self.assertEqual(e.message, "Your card's security code is invalid")
self.assertEqual(e.args[0], "Your card's security code is invalid")
def test_missing_card(self):
"""There is no card on a customer that is being charged"""
@ -504,7 +504,7 @@ class StripeErrorTest(TestCase):
sc.create_charge(10, customer = cust1.id, description="$10 for cust w/ no card")
except stripe.CardError as e:
self.assertEqual(e.code, "missing")
self.assertEqual(e.message, "Cannot charge a customer that has no active card")
self.assertEqual(e.args[0], "Cannot charge a customer that has no active card")
class PledgeScenarioTest(TestCase):
@classmethod
@ -578,7 +578,7 @@ class Processor(baseprocessor.Processor):
else:
customer = sc.create_customer(card=token, description='anonymous user', email=email)
except stripe.StripeError as e:
raise StripelibError(e.message, e)
raise StripelibError(e.args, e)
account = Account(host = PAYMENT_HOST_STRIPE,
account_id = customer.id,
@ -746,11 +746,11 @@ class Processor(baseprocessor.Processor):
# use PaymentResponse to store error
r = PaymentResponse.objects.create(api="stripelib.Execute", correlation_id=None,
timestamp=now(), info=e.message,
timestamp=now(), info=e.args,
status=TRANSACTION_STATUS_ERROR, transaction=transaction)
transaction.status = TRANSACTION_STATUS_ERROR
self.errorMessage = e.message # manager puts this on transaction
self.errorMessage = e.args # manager puts this on transaction
transaction.save()
# fire off the fact that transaction failed -- should actually do so only if not a transient error
@ -759,9 +759,8 @@ class Processor(baseprocessor.Processor):
transaction_failed.send(sender=self, transaction=transaction)
# otherwise, report exception to us
else:
logger.exception("transaction id {0}, exception: {1}".format(transaction.id, e.message))
logger.exception("transaction id {0}, exception: {1}".format(transaction.id, e.args))
# raise StripelibError(e.message, e)
else:
self.charge = charge

View File

@ -14,7 +14,7 @@ django imports
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.requests import RequestSite
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.http import (
HttpResponse,
HttpRequest,

View File

@ -21,24 +21,25 @@ chardet==3.0.4
django-celery==3.2.2
django-ckeditor==5.6.1
#django-email-change==0.2.3
git+git://github.com/eshellman/django-email-change.git@87cd33bb7467b6203986d7d5763e2699155cedd4
git+git://github.com/eshellman/django-email-change.git@830808b9b9db5f3ca9ec0cb22f8fda5cc2cef12d
django-compat==1.0.15
django-contrib-comments==1.7.1
django-contrib-comments==1.8.0
django-el-pagination==3.2.4
django-extensions==1.6.1
django-jsonfield==1.0.0
#django-kombu==0.9.4
django-mptt==0.8.6
#django-notification==0.2
git+git://github.com/eshellman/django-notification.git@c830ffa29d95e986dda5498a8a74e4a9334283c9
django-registration==2.1.2
git+git://github.com/eshellman/django-notification.git@b560b780973f2d78a6a8c635501c1ece01f5e6a3
django-registration==2.4.1
django-selectable==1.1.0
django-smtp-ssl==1.0
django-storages==1.5.2
django-tastypie==0.14.1
#django-transmeta==0.7.3
git+git://github.com/resulto/django-transmeta.git@ad4d7278ba330dcf8c8446f8ae9b2c769ae8684e
fef-questionnaire==4.0.1
#fef-questionnaire==4.0.1
git+git://github.com/EbookFoundation/fef-questionnaire.git@b8ac5a1a9f208a7e48916d3cf489aeef0fe7a8f9
#gitenberg.metadata==0.1.6
git+git://github.com/gitenberg-dev/gitberg-build.git@61a5fb0011e1a547b1eac14dd845ce37dbb5f85a
#git+ssh://git@github.com/gitenberg-dev/metadata.git@0.1.11

View File

@ -71,8 +71,6 @@ CELERYD_HIJACK_ROOT_LOGGER = False
# a debug_toolbar setting
INTERNAL_IPS = ('127.0.0.1',)
CELERYD_LOG_LEVEL = "INFO"
# decide which of the period tasks to add to the schedule
#CELERYBEAT_SCHEDULE['send_test_email'] = SEND_TEST_EMAIL_JOB
#CELERYBEAT_SCHEDULE['refresh_acqs'] = REFRESH_ACQS_JOB

View File

@ -21,7 +21,7 @@ urlpatterns = [
url(r'', include('regluit.marc.urls')),
url(r'^bisac/', include('regluit.bisac.urls')),
url(r'^selectable/', include('selectable.urls')),
url(r'^admin/', include(site.urls)),
url(r'^admin/', site.urls),
url(r'^comments/', include('django_comments.urls')),
url(r"^notification/", include('notification.urls')),
url(r'^ckeditor/upload/', login_required(ckedit_views.upload), name='ckeditor_upload'),