From 983416c0e12a913f47c325cc69c898ec36630cf6 Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 23 Apr 2014 10:55:20 +0200 Subject: [PATCH 1/7] cleaned up exceptions, python3 compatible (I hope) --- eav/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eav/models.py b/eav/models.py index 9de7ab2..1544567 100644 --- a/eav/models.py +++ b/eav/models.py @@ -491,7 +491,7 @@ def validate_attributes(self): else: try: attribute.validate_value(value) - except ValidationError, e: + except ValidationError as e: raise ValidationError(_(u"%(attr)s EAV field %(err)s") % \ {'attr': attribute.slug, 'err': e}) From 249c489d118b7dd6d25f41908d38e1a8592ae22a Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 23 Apr 2014 10:59:54 +0200 Subject: [PATCH 2/7] Will this fix teh packaging problem? --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b4727b7..d029683 100755 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ 'Django app.', long_description=open('README.rst').read(), - url='http://github.com/mvpdev/django-eav', + url='http://github.com/ckingswood/django-eav', packages=['eav', 'eav.tests'], From 07c83a567a978093ee2df2b02f27f25e84569bbd Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 23 Apr 2014 12:58:10 +0200 Subject: [PATCH 3/7] updated readme to expain this fork. --- README.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.rst b/README.rst index c0aac2d..d590504 100644 --- a/README.rst +++ b/README.rst @@ -5,6 +5,9 @@ django-eav Introduction ------------ +This is a fork of https://github.com/mvpdev/django-eav, which will be Python 3 compatible. + + django-eav provides an Entity-Attribute-Value storage model for django apps. For a decent explanation of what an Entity-Attribute-Value storage model is, From 514d2b1b5f66f3cd139e18fa5f011a6021b130c1 Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 23 Apr 2014 12:58:28 +0200 Subject: [PATCH 4/7] updated readme --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index d590504..a6904e6 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ django-eav Introduction ------------ -This is a fork of https://github.com/mvpdev/django-eav, which will be Python 3 compatible. +This is a fork of https://github.com/mvpdev/django-eav, to make it Python 3 compatible. django-eav provides an Entity-Attribute-Value storage model for django apps. From 1bc5cfe1e067bd9ffe6c898db544d84b59e54de2 Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 23 Apr 2014 14:17:26 +0200 Subject: [PATCH 5/7] removed check for unicode type in Python 3 --- eav/validators.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eav/validators.py b/eav/validators.py index f5d6c5a..ce8fd68 100644 --- a/eav/validators.py +++ b/eav/validators.py @@ -45,7 +45,8 @@ def validate_text(value): ''' Raises ``ValidationError`` unless *value* type is ``str`` or ``unicode`` ''' - if not (type(value) == unicode or type(value) == str): + print(value, type(value)) + if not (type(value) == str): raise ValidationError(_(u"Must be str or unicode")) From 275ae24c6e57a44599a38a49085f35041ecc6923 Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 23 Apr 2014 14:43:44 +0200 Subject: [PATCH 6/7] got registry import working, and removed debug print --- eav/__init__.py | 4 ++-- eav/validators.py | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/eav/__init__.py b/eav/__init__.py index 73a21be..1052950 100644 --- a/eav/__init__.py +++ b/eav/__init__.py @@ -27,9 +27,9 @@ def get_version(): __version__ = get_version() def register(model_cls, config_cls=None): - from registry import Registry + from eav.registry import Registry Registry.register(model_cls, config_cls) def unregister(model_cls): - from registry import Registry + from eav.registry import Registry Registry.unregister(model_cls) diff --git a/eav/validators.py b/eav/validators.py index ce8fd68..f3276ca 100644 --- a/eav/validators.py +++ b/eav/validators.py @@ -45,7 +45,6 @@ def validate_text(value): ''' Raises ``ValidationError`` unless *value* type is ``str`` or ``unicode`` ''' - print(value, type(value)) if not (type(value) == str): raise ValidationError(_(u"Must be str or unicode")) From 6012dfbd14eeea0a38ac2fc8104f35cedc58aea8 Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 23 Apr 2014 16:12:49 +0200 Subject: [PATCH 7/7] changed imports --- eav/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eav/__init__.py b/eav/__init__.py index 1052950..e4cc249 100644 --- a/eav/__init__.py +++ b/eav/__init__.py @@ -27,9 +27,9 @@ def get_version(): __version__ = get_version() def register(model_cls, config_cls=None): - from eav.registry import Registry + from .registry import Registry Registry.register(model_cls, config_cls) def unregister(model_cls): - from eav.registry import Registry + from .registry import Registry Registry.unregister(model_cls)