Skip to content

Commit

Permalink
naming parameters - django-oscar 1.1 compatible
Browse files Browse the repository at this point in the history
ERROR Internal Server Error: /en/checkout/paypal/preview/5/
Traceback (most recent call last):
  File "/virtenvs/test/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/virtenvs/test/lib/python2.7/site-packages/django/utils/decorators.py", line 145, in inner
    return func(*args, **kwargs)
  File "/virtenvs/test/lib/python2.7/site-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/virtenvs/test/lib/python2.7/site-packages/oscar/apps/checkout/session.py", line 68, in dispatch
    request, *args, **kwargs)
  File "/virtenvs/test/lib/python2.7/site-packages/django/views/generic/base.py", line 89, in dispatch
    return handler(request, *args, **kwargs)
  File "/virtenvs/test/lib/python2.7/site-packages/paypal/express/views.py", line 200, in get
    kwargs['basket'] = self.load_frozen_basket(kwargs['basket_id'])
  File "/virtenvs/test/lib/python2.7/site-packages/paypal/express/views.py", line 231, in load_frozen_basket
    Applicator().apply(self.request, basket)
  File "/virtenvs/test/lib/python2.7/site-packages/oscar/apps/offer/applicator.py", line 26, in apply
    offers = self.get_offers(basket, user, request)
  File "/virtenvs/test/lib/python2.7/site-packages/oscar/apps/offer/applicator.py", line 58, in get_offers
    basket_offers = self.get_basket_offers(basket, user)
  File "/virtenvs/test/lib/python2.7/site-packages/oscar/apps/offer/applicator.py", line 94, in get_basket_offers
    if not basket.id or not user:
AttributeError: 'WSGIRequest' object has no attribute 'id'
  • Loading branch information
phedoreanu committed Jun 29, 2015
1 parent d98ca35 commit b74153f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions paypal/express/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import oscar
from oscar.apps.payment.exceptions import UnableToTakePayment
from oscar.core.exceptions import ModuleNotFoundError
from oscar.core.loading import get_class, get_model
from oscar.apps.shipping.methods import FixedPrice, NoShippingRequired

Expand All @@ -34,10 +35,14 @@
Country = get_model('address', 'Country')
Basket = get_model('basket', 'Basket')
Repository = get_class('shipping.repository', 'Repository')
Applicator = get_class('offer.utils', 'Applicator')
Selector = get_class('partner.strategy', 'Selector')
Source = get_model('payment', 'Source')
SourceType = get_model('payment', 'SourceType')
try:
Applicator = get_class('offer.applicator', 'Applicator')
except ModuleNotFoundError:
# fallback for django-oscar<=1.1
Applicator = get_class('offer.utils', 'Applicator')

logger = logging.getLogger('paypal.express')

Expand Down Expand Up @@ -225,7 +230,7 @@ def load_frozen_basket(self, basket_id):
basket.strategy = Selector().strategy(self.request)

# Re-apply any offers
Applicator().apply(self.request, basket)
Applicator().apply(request=self.request, basket=basket)

return basket

Expand Down

0 comments on commit b74153f

Please sign in to comment.