From dbc15e4b32d62069c980eb6ad5cd2f6f7a9048e9 Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen Date: Sun, 28 Jun 2015 11:16:25 +0300 Subject: testing/py-django-oscar: compatibility with py-django-widget-tweaks 1.4 https://github.com/django-oscar/django-oscar/pull/1791 https://github.com/django-oscar/django-oscar/pull/1793 --- ...-make-deepcopy-work-for-Product-instances.patch | 29 +++++++++++++++++ ...pcopy-work-for-partner-strategy-instances.patch | 37 ++++++++++++++++++++++ testing/py-django-oscar/APKBUILD | 20 ++++++++---- 3 files changed, 80 insertions(+), 6 deletions(-) create mode 100644 testing/py-django-oscar/0001-make-deepcopy-work-for-Product-instances.patch create mode 100644 testing/py-django-oscar/0002-make-deepcopy-work-for-partner-strategy-instances.patch (limited to 'testing/py-django-oscar') diff --git a/testing/py-django-oscar/0001-make-deepcopy-work-for-Product-instances.patch b/testing/py-django-oscar/0001-make-deepcopy-work-for-Product-instances.patch new file mode 100644 index 0000000000..202201f922 --- /dev/null +++ b/testing/py-django-oscar/0001-make-deepcopy-work-for-Product-instances.patch @@ -0,0 +1,29 @@ +From b2d85ed3d04881e2806e39c4df64db53dfbdea80 Mon Sep 17 00:00:00 2001 +From: Kaarle Ritvanen +Date: Sun, 28 Jun 2015 10:37:41 +0300 +Subject: [PATCH 1/2] make deepcopy work for Product instances + +required for django-widget-tweaks 1.4 compatibility +--- + src/oscar/apps/catalogue/abstract_models.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/oscar/apps/catalogue/abstract_models.py b/src/oscar/apps/catalogue/abstract_models.py +index 331b270..3d02eb5 100644 +--- a/src/oscar/apps/catalogue/abstract_models.py ++++ b/src/oscar/apps/catalogue/abstract_models.py +@@ -720,7 +720,10 @@ class ProductAttributesContainer(object): + self.initialised = False + + def __getattr__(self, name): +- if not name.startswith('_') and not self.initialised: ++ if name.startswith('_'): ++ raise AttributeError( ++ _('Invalid attribute: %(attr)s') % {'attr': name}) ++ if not self.initialised: + values = self.get_values().select_related('attribute') + for v in values: + setattr(self, v.attribute.code, v.value) +-- +2.1.0 + diff --git a/testing/py-django-oscar/0002-make-deepcopy-work-for-partner-strategy-instances.patch b/testing/py-django-oscar/0002-make-deepcopy-work-for-partner-strategy-instances.patch new file mode 100644 index 0000000000..49d5575fcb --- /dev/null +++ b/testing/py-django-oscar/0002-make-deepcopy-work-for-partner-strategy-instances.patch @@ -0,0 +1,37 @@ +From f4927825fb534ff535cc25bc7a8589479eaa8286 Mon Sep 17 00:00:00 2001 +From: Kaarle Ritvanen +Date: Sun, 28 Jun 2015 10:39:08 +0300 +Subject: [PATCH 2/2] make deepcopy work for partner strategy instances + +required for django-widget-tweaks 1.4 compatibility +--- + src/oscar/apps/partner/strategy.py | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/oscar/apps/partner/strategy.py b/src/oscar/apps/partner/strategy.py +index f65ebd8..66a9e2a 100644 +--- a/src/oscar/apps/partner/strategy.py ++++ b/src/oscar/apps/partner/strategy.py +@@ -1,4 +1,5 @@ + from collections import namedtuple ++from copy import deepcopy + from decimal import Decimal as D + + from . import availability, prices +@@ -54,6 +55,13 @@ class Base(object): + if request and request.user.is_authenticated(): + self.user = request.user + ++ def __deepcopy__(self, memo): ++ res = self.__class__(self.request) ++ for k, v in self.__dict__.items(): ++ if k != 'request': ++ res.__dict__[deepcopy(k, memo)] = deepcopy(v, memo) ++ return res ++ + def fetch_for_product(self, product, stockrecord=None): + """ + Given a product, return a ``PurchaseInfo`` instance. +-- +2.1.0 + diff --git a/testing/py-django-oscar/APKBUILD b/testing/py-django-oscar/APKBUILD index d01f9976f3..3c657277df 100644 --- a/testing/py-django-oscar/APKBUILD +++ b/testing/py-django-oscar/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: pkgname=py-django-oscar pkgver=1.1 -pkgrel=0 +pkgrel=1 pkgdesc="Domain-driven e-commerce for Django" url=http://oscarcommerce.com/ arch=noarch @@ -12,7 +12,9 @@ depends="py-babel py-django py-django-compressor py-django-extra-views py-django-treebeard py-django-widget-tweaks py-factory-boy py-mock py-phonenumbers py-pillow py-purl py-unidecode" makedepends=py-setuptools -source="https://pypi.python.org/packages/source/d/django-oscar/django-oscar-$pkgver.tar.gz" +source="https://pypi.python.org/packages/source/d/django-oscar/django-oscar-$pkgver.tar.gz + 0001-make-deepcopy-work-for-Product-instances.patch + 0002-make-deepcopy-work-for-partner-strategy-instances.patch" _builddir=$srcdir/django-oscar-$pkgver prepare() { @@ -20,7 +22,7 @@ prepare() { cd "$_builddir" for i in $source; do case $i in - *.patch) msg $i; patch -p2 -i "$srcdir"/$i || return 1;; + *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; esac done } @@ -35,6 +37,12 @@ package() { ./setup.py install --root "$pkgdir" } -md5sums="290bc1708c3ddb61f9ee55be9a90d7c1 django-oscar-1.1.tar.gz" -sha256sums="33b18e7854fde53d5ef2b0f8128974a31ae3049adc3a313002e0674ba1a1c4f1 django-oscar-1.1.tar.gz" -sha512sums="73e630389a3beea4a0555bd05f3ee301be79adb6e10e1c84ee105a2c11c683be22791f44468cddcd48b5000f355e345ba6eb7c0d9cabb0c3c4fafb94a02cdf5b django-oscar-1.1.tar.gz" +md5sums="290bc1708c3ddb61f9ee55be9a90d7c1 django-oscar-1.1.tar.gz +04bacab94b2e25af5061a50145407589 0001-make-deepcopy-work-for-Product-instances.patch +5c0149e659d2b37e89f53c4c8a6c064a 0002-make-deepcopy-work-for-partner-strategy-instances.patch" +sha256sums="33b18e7854fde53d5ef2b0f8128974a31ae3049adc3a313002e0674ba1a1c4f1 django-oscar-1.1.tar.gz +11495df8e7fa9b346c1394e7613f9526ba33aee1e29ec52470980f3c7abc699e 0001-make-deepcopy-work-for-Product-instances.patch +b101bce0a3319a589bec0329d386dbe86fdb3058d46f4b4705f46db09cbd24cf 0002-make-deepcopy-work-for-partner-strategy-instances.patch" +sha512sums="73e630389a3beea4a0555bd05f3ee301be79adb6e10e1c84ee105a2c11c683be22791f44468cddcd48b5000f355e345ba6eb7c0d9cabb0c3c4fafb94a02cdf5b django-oscar-1.1.tar.gz +3f5293e32278c852ae2c5888bd2c127374d3445cfa557a26487c9ba4eb9f2380b9752e63c8f9875f8224e577c13cc68594566f7989142d0f7a67cb14f86b8723 0001-make-deepcopy-work-for-Product-instances.patch +475c65f8fd3bf1c35b1ba1d5922f376cfc2b9a5444f102329fce46cc86e6b302eb909b490f70df7c87e89d7804b0844fcc44493b4ad6344123530d8a9be16868 0002-make-deepcopy-work-for-partner-strategy-instances.patch" -- cgit v1.2.3