|
7 | 7 | from django.apps.config import MODELS_MODULE_NAME |
8 | 8 | from django.conf import settings |
9 | 9 | from django.core.exceptions import ImproperlyConfigured, AppRegistryNotReady |
| 10 | + from django import forms |
10 | 11 |
|
11 | 12 | # from oscar.core.compat |
12 | 13 | # A setting that can be used in foreign key declarations |
@@ -63,7 +64,32 @@ def is_model_registered(app_label, model_name): |
63 | 64 | else: |
64 | 65 | return True |
65 | 66 |
|
| 67 | + # from oscar.apps.payment.exceptions |
| 68 | + class UnableToTakePayment(Exception): |
| 69 | + """ |
| 70 | + Exception to be used for ANTICIPATED payment errors (eg card number wrong, |
| 71 | + expiry date has passed). The message passed here will be shown to the end |
| 72 | + user. |
| 73 | + """ |
| 74 | + |
| 75 | + # dummy for oscar.templatetags.currency_filters.currency |
| 76 | + def currency(value, currency=None): |
| 77 | + return value |
| 78 | + |
| 79 | + # dummy for oscar.forms.widgets.DatePickerInput |
| 80 | + DatePickerInput = forms.DateInput |
| 81 | + |
| 82 | + # dummy for oscar.application.Application |
| 83 | + class Application(object): |
| 84 | + def post_process_urls(self, urlpatterns): |
| 85 | + return urlpatterns |
| 86 | + |
| 87 | + |
66 | 88 | else: # oscar is installed, use it. |
| 89 | + from oscar.apps.payment.exceptions import UnableToTakePayment |
| 90 | + from oscar.core.application import Application |
67 | 91 | from oscar.core.compat import AUTH_USER_MODEL |
68 | 92 | from oscar.core.loading import get_model, is_model_registered |
| 93 | + from oscar.forms.widgets import DatePickerInput |
| 94 | + from oscar.templatetags.currency_filters import currency |
69 | 95 |
|
0 commit comments