Permalink
Browse files

Merge pull request #52 from django-oscar/oscar15

Update to work with Oscar 1.5 and Django 1.11
  • Loading branch information...
2 parents be57d82 + e12c38a commit 3ea967f86033aee6a391d2fda25a8c6a7bda8735 @solarissmoke solarissmoke committed Aug 19, 2017
View
@@ -5,12 +5,13 @@
dist/*
build/*
*.egg-info
+.eggs
# Sandbox
sandbox/db.sqlite
settings_local.py
# Testing
.coverage
-.coveralls.yml
.tox
+.cache
View
@@ -1,38 +1,40 @@
language: python
-
sudo: false
-python:
- - 2.7
- - 3.3
- - 3.4
- - 3.5
-
-env:
- - DJANGO=Django==1.8.11
- - DJANGO=Django==1.9.4
-
matrix:
- exclude:
- - python: 3.5
-
-matrix:
- exclude:
- - python: 3.2
- env: "DJANGO=Django==1.9.4"
- - python: 3.3
- env: "DJANGO=Django==1.9.4"
-
-
-before_install:
- - pip install codecov
+ include:
+ - python: 2.7
+ env: TOXENV=py27-django18
+ - python: 2.7
+ env: TOXENV=py27-django110
+ - python: 2.7
+ env: TOXENV=py27-django111
+ - python: 3.3
+ env: TOXENV=py33-django18
+ - python: 3.4
+ env: TOXENV=py34-django18
+ - python: 3.4
+ env: TOXENV=py34-django110
+ - python: 3.4
+ env: TOXENV=py34-django111
+ - python: 3.5
+ env: TOXENV=py35-django18
+ - python: 3.5
+ env: TOXENV=py35-django110
+ - python: 3.5
+ env: TOXENV=py35-django111
+ - python: 3.6
+ env: TOXENV=py36-django111
+
+ - python: 3.5
+ env: TOXENV=lint
install:
- - pip install --pre $DJANGO django-oscar==1.2rc1
- - pip install -e .[test]
+ - pip install tox codecov
script:
- - py.test --cov=oscar_accounts
+ - tox
after_success:
- - codecov
+ - tox -e coverage-report
+ - codecov
View
@@ -1,24 +1,21 @@
-.PHONY: install test sandbox clean update-requirements
+.PHONY: install test sandbox clean
install:
- pip install --pre -e .[test]
+ pip install -e . -r requirements.txt
test:
./runtests.py
sandbox: install
- pip install -r requirements.sandbox.txt
-rm sandbox/db.sqlite
sandbox/manage.py migrate
sandbox/manage.py loaddata sandbox/fixtures/users.json
+ sandbox/manage.py oscar_accounts_init
clean:
find . -type f -name "*.pyc" -delete
rm -rf htmlcov *.egg-info *.pdf dist
-update-requirements:
- pip-compile --upgrade --rebuild --pre requirements.sandbox.in || echo "\n\nPlease install pip-compile: pip install pip-tools"
-
release:
pip install twine wheel
rm -rf dist/*
View
@@ -21,7 +21,7 @@ system.
This package uses `double-entry bookkeeping`_ where every transaction is
recorded twice (once for the source and once for the destination). This
ensures the books always balance and there is full audit trail of all
-transactional activity.
+transactional activity.
If your project manages money, you should be using a library like this. Your
finance people will thank you.
@@ -157,7 +157,7 @@ Furthermore you need to add the url-pattern to your `urls.py`
urlpatterns = [
...
- url(r'^dashboard/accounts/', include(accounts_app.urls)),
+ url(r'^dashboard/accounts/', accounts_app.urls),
]
@@ -212,14 +212,14 @@ Reverse transfers:
.. code-block:: python
- facade.reverse(trans, user=staff_member,
+ facade.reverse(trans, user=staff_member,
description="Just an example")
If the proposed transfer is invalid, an exception will be raised. All
exceptions are subclasses of `oscar_accounts.exceptions.AccountException`.
Your client code should look for exceptions of this type and handle them
appropriately.
-
+
Client code should only use the `oscar_accounts.models.Budget` class and the
two functions from `oscar_accounts.facade` - nothing else should be required.
@@ -307,8 +307,8 @@ encapsulate your business logic and error handling. Here's an example:
for transfer in completed_transfers:
facade.reverse(transfer)
except Exception, reverse_exc:
- # Uh oh: No man's land. We could be left with a partial
- # redemption. This will require an admin to intervene. Make
+ # Uh oh: No man's land. We could be left with a partial
+ # redemption. This will require an admin to intervene. Make
# sure your logger mails admins on error.
logger.error("Order %s, transfers failed (%s) and reverse failed (%s)",
order_number, transfer_exc, reverse_exc)
@@ -350,14 +350,14 @@ Core accounts and account types
A post-syncdb signal will create the common structure for account types and
accounts. Some names can be controlled with settings, as indicated in
-parentheses.
+parentheses.
- **Assets**
- **Sales**
- Redemptions (`ACCOUNTS_REDEMPTIONS_NAME`) - where money is
- transferred to when an account is used to pay for something.
+ transferred to when an account is used to pay for something.
- Lapsed (`ACCOUNTS_LAPSED_NAME`) - where money is transferred to
when an account expires. This is done by the
'close_expired_accounts' management command. The name of this
@@ -387,13 +387,13 @@ Example transactions
Consider the following accounts and account types:
- **Assets**
- - **Sales**
- - Redemptions
+ - **Sales**
+ - Redemptions
- Lapsed
- **Cash**
- - Bank
+ - Bank
- **Unpaid**
- - Merchant funded
+ - Merchant funded
- **Liabilities**
- **Deferred income**
@@ -439,5 +439,5 @@ Fork repo, set-up virtualenv and run::
make install
Run tests with::
-
- ./runtests.py
+
+ pytest
View
@@ -1,2 +0,0 @@
-Django>=1.8.11
-django-oscar==1.2
View
@@ -1,28 +0,0 @@
-#
-# This file is autogenerated by pip-compile
-# Make changes in requirements.sandbox.in, then run this to update:
-#
-# pip-compile requirements.sandbox.in
-#
-Babel==1.3 # via django-oscar
-django-extra-views==0.6.4 # via django-oscar
-django-haystack==2.4.1 # via django-oscar
-django-oscar==1.2
-django-tables2==1.0.7 # via django-oscar
-django-treebeard==4.0 # via django-oscar
-django-widget-tweaks==1.4.1 # via django-oscar
-Django==1.8.11 # via django-extra-views, django-haystack, django-oscar, django-tables2, django-treebeard
-factory-boy==2.6.1 # via django-oscar
-fake-factory==0.5.7 # via factory-boy
-funcsigs==0.4 # via mock
-ipaddress==1.0.16 # via fake-factory
-mock==1.3.0 # via django-oscar
-pbr==1.8.1 # via mock
-phonenumbers==7.2.7 # via django-oscar
-pillow==3.1.1 # via django-oscar
-purl==1.2 # via django-oscar
-python-dateutil==2.5.1 # via fake-factory
-pytz==2016.1 # via babel
-six==1.10.0 # via django-tables2, fake-factory, mock, purl, python-dateutil
-sorl-thumbnail==12.3 # via django-oscar
-Unidecode==0.4.19 # via django-oscar
View
@@ -1 +0,0 @@
--e .[test]
View
@@ -0,0 +1,10 @@
+django-oscar>=1.2,<1.6
+
+# Testing
+coverage==4.4.1
+django-webtest==1.9.2
+factory-boy>=2.9,<2.10
+mock==2.0.0
+pytest-django==3.1.2
+pytest==3.2.1
+tox==2.7.0
View
@@ -1,14 +0,0 @@
-#!/usr/bin/env python
-import logging
-import sys
-
-import pytest
-
-# No logging
-logging.disable(logging.CRITICAL)
-
-
-if __name__ == '__main__':
- args = sys.argv[1:]
- result_code = pytest.main(args)
- sys.exit(result_code)
View
@@ -10,7 +10,6 @@
location = lambda x: os.path.join(os.path.dirname(os.path.realpath(__file__)), x)
DEBUG = True
-TEMPLATE_DEBUG = True
SQL_DEBUG = True
ADMINS = (
@@ -76,29 +75,7 @@
# Make this unique, and don't share it with anybody.
SECRET_KEY = '$)a7n&o80u!6y5t-+jrd3)3!%vh&shg$wqpjpxc!ar&p#!)n1a'
-# List of callables that know how to import templates from various sources.
-TEMPLATE_LOADERS = (
- 'django.template.loaders.filesystem.Loader',
- 'django.template.loaders.app_directories.Loader',
- 'django.template.loaders.eggs.Loader',
-)
-
-TEMPLATE_CONTEXT_PROCESSORS = (
- "django.contrib.auth.context_processors.auth",
- "django.core.context_processors.request",
- "django.core.context_processors.debug",
- "django.core.context_processors.i18n",
- "django.core.context_processors.media",
- "django.core.context_processors.static",
- "django.contrib.messages.context_processors.messages",
- # Oscar specific
- 'oscar.apps.search.context_processors.search_form',
- 'oscar.apps.promotions.context_processors.promotions',
- 'oscar.apps.checkout.context_processors.checkout',
- 'oscar.core.context_processors.metadata',
-)
-
-MIDDLEWARE_CLASSES = (
+MIDDLEWARE = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
@@ -112,11 +89,38 @@
ROOT_URLCONF = 'urls'
-TEMPLATE_DIRS = (
- location('templates'),
- OSCAR_MAIN_TEMPLATE_DIR,
- ACCOUNTS_TEMPLATE_DIR,
-)
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [
+ location('templates'),
+ OSCAR_MAIN_TEMPLATE_DIR,
+ ACCOUNTS_TEMPLATE_DIR,
+ ],
+ 'OPTIONS': {
+ 'loaders': [
+ 'django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader',
+ 'django.template.loaders.eggs.Loader',
+ ],
+ 'context_processors': [
+ "django.contrib.auth.context_processors.auth",
+ "django.template.context_processors.request",
+ "django.template.context_processors.debug",
+ "django.template.context_processors.i18n",
+ "django.template.context_processors.media",
+ "django.template.context_processors.static",
+ "django.contrib.messages.context_processors.messages",
+ # Oscar specific
+ 'oscar.apps.search.context_processors.search_form',
+ 'oscar.apps.promotions.context_processors.promotions',
+ 'oscar.apps.checkout.context_processors.checkout',
+ 'oscar.core.context_processors.metadata',
+ ],
+ 'debug': DEBUG,
+ }
+ }
+]
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
@@ -135,10 +139,6 @@
},
},
'handlers': {
- 'null': {
- 'level': 'DEBUG',
- 'class': 'django.utils.log.NullHandler',
- },
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
@@ -150,11 +150,6 @@
},
},
'loggers': {
- 'django': {
- 'handlers': ['null'],
- 'propagate': True,
- 'level': 'INFO',
- },
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
@@ -165,11 +160,6 @@
'propagate': True,
'level': 'INFO',
},
- 'django.db.backends': {
- 'handlers': ['null'],
- 'propagate': False,
- 'level': 'DEBUG',
- },
'accounts': {
'handlers': ['console'],
'propagate': False,
@@ -194,7 +184,7 @@
] + get_core_apps(['apps.shipping']) + ['oscar_accounts']
AUTHENTICATION_BACKENDS = (
- 'oscar.apps.customer.auth_backends.Emailbackend',
+ 'oscar.apps.customer.auth_backends.EmailBackend',
'django.contrib.auth.backends.ModelBackend',
)
Oops, something went wrong.

0 comments on commit 3ea967f

Please sign in to comment.