Hello community,
here is the log from the commit of package python3-django-picklefield for
openSUSE:Factory checked in at 2015-10-22 12:59:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python3-django-picklefield (Old)
and /work/SRC/openSUSE:Factory/.python3-django-picklefield.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-django-picklefield"
Changes:
--------
---
/work/SRC/openSUSE:Factory/python3-django-picklefield/python3-django-picklefield.changes
2014-12-19 09:37:39.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.python3-django-picklefield.new/python3-django-picklefield.changes
2015-10-22 12:59:23.000000000 +0200
@@ -1,0 +2,12 @@
+Tue Oct 20 03:20:47 UTC 2015 - [email protected]
+
+- specfile:
+ * update copyright year
+ * README->README.rst
+
+- update to version 0.3.2:
+ * Dropped support for Django 1.3.
+ * Dropped support for Python 2.5.
+ * Silenced deprecation warnings on Django 1.8+.
+
+-------------------------------------------------------------------
Old:
----
django-picklefield-0.3.1.tar.gz
New:
----
django-picklefield-0.3.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python3-django-picklefield.spec ++++++
--- /var/tmp/diff_new_pack.cxEPly/_old 2015-10-22 12:59:23.000000000 +0200
+++ /var/tmp/diff_new_pack.cxEPly/_new 2015-10-22 12:59:23.000000000 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python3-django-picklefield
#
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: python3-django-picklefield
-Version: 0.3.1
+Version: 0.3.2
Release: 0
Url: http://github.com/gintas/django-picklefield
Summary: Pickled object field for Django
@@ -52,7 +52,7 @@
%files
%defattr(-,root,root,-)
-%doc README
+%doc README.rst
%{python3_sitelib}/*
%changelog
++++++ django-picklefield-0.3.1.tar.gz -> django-picklefield-0.3.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-picklefield-0.3.1/PKG-INFO
new/django-picklefield-0.3.2/PKG-INFO
--- old/django-picklefield-0.3.1/PKG-INFO 2013-11-15 22:25:57.000000000
+0100
+++ new/django-picklefield-0.3.2/PKG-INFO 2015-09-06 19:46:11.000000000
+0200
@@ -1,25 +1,31 @@
Metadata-Version: 1.1
Name: django-picklefield
-Version: 0.3.1
+Version: 0.3.2
Summary: Pickled object field for Django
Home-page: http://github.com/gintas/django-picklefield
Author: Gintautas Miliauskas
Author-email: [email protected]
License: UNKNOWN
-Description: -----
+Description: .. image::
https://travis-ci.org/gintas/django-picklefield.svg?branch=master
+ :target: https://travis-ci.org/gintas/django-picklefield
+
+ .. image::
https://coveralls.io/repos/gintas/django-picklefield/badge.svg?branch=master&service=github
+ :target:
https://coveralls.io/github/gintas/django-picklefield?branch=master
+
+ -----
About
-----
**django-picklefield** provides an implementation of a pickled object
field.
Such fields can contain any picklable objects.
- The implementation is taken and adopted from Django snippet #1694
- <http://www.djangosnippets.org/snippets/1694/> by Taavi Taijala, which
is in
- turn based on Django snippet #513
<http://www.djangosnippets.org/snippets/513/>
- by Oliver Beattie.
+ The implementation is taken and adopted from `Django snippet #1694`_
by Taavi
+ Taijala, which is in turn based on `Django snippet #513`_ by Oliver
Beattie.
django-picklefield is available under the MIT license.
+ .. _Django snippet #1694: http://www.djangosnippets.org/snippets/1694/
+ .. _Django snippet #513: http://www.djangosnippets.org/snippets/513/
-----
Usage
@@ -52,6 +58,17 @@
format is not convenient for parsing in the browser. By overriding
``value_to_string()`` you can choose a more convenient serialization
format.
+ -------------
+ Running tests
+ -------------
+
+ The full test suite can be run with `Tox`_::
+
+ >>> pip install tox
+ >>> tox
+
+ .. _Tox: https://testrun.org/tox/latest/
+
--------------
Original notes
--------------
@@ -122,77 +139,84 @@
Changes
-------
+ Changes in version 0.3.2
+ ========================
+
+ * Dropped support for Django 1.3.
+ * Dropped support for Python 2.5.
+ * Silenced deprecation warnings on Django 1.8+.
+
Changes in version 0.3.1
========================
- * Favor the built in json module (thanks to Simon Charette).
+ * Favor the built in json module (thanks to Simon Charette).
Changes in version 0.3.0
========================
- * Python 3 support (thanks to Rafal Stozek).
+ * Python 3 support (thanks to Rafal Stozek).
Changes in version 0.2.0
========================
- * Allow pickling of subclasses of django.db.models.Model (thanks to
Simon
- Charette).
+ * Allow pickling of subclasses of django.db.models.Model (thanks to
Simon
+ Charette).
Changes in version 0.1.9
========================
- * Added `connection` and `prepared` parameters to
`get_db_prep_value()` too
- (thanks to Matthew Schinckel).
+ * Added `connection` and `prepared` parameters to
`get_db_prep_value()` too
+ (thanks to Matthew Schinckel).
Changes in version 0.1.8
========================
- * Updated link to code repository.
+ * Updated link to code repository.
Changes in version 0.1.7
========================
- * Added `connection` and `prepared` parameters to
`get_db_prep_lookup()` to
- get rid of deprecation warnings in Django 1.2.
+ * Added `connection` and `prepared` parameters to
`get_db_prep_lookup()` to
+ get rid of deprecation warnings in Django 1.2.
Changes in version 0.1.6
========================
- * Fixed South support (thanks aehlke@github).
+ * Fixed South support (thanks aehlke@github).
Changes in version 0.1.5
========================
- * Added support for South.
- * Changed default to null=False, as is common throughout Django.
+ * Added support for South.
+ * Changed default to null=False, as is common throughout Django.
Changes in version 0.1.4
========================
- * Updated copyright statements.
+ * Updated copyright statements.
Changes in version 0.1.3
========================
- * Updated serialization tests (thanks to Michael Fladischer).
+ * Updated serialization tests (thanks to Michael Fladischer).
Changes in version 0.1.2
========================
- * Added Simplified BSD licence.
+ * Added Simplified BSD licence.
Changes in version 0.1.1
========================
- * Added test for serialization.
- * Added note about JSON serialization for browser.
- * Added support for different pickle protocol versions (thanks to
Michael
- Fladischer).
+ * Added test for serialization.
+ * Added note about JSON serialization for browser.
+ * Added support for different pickle protocol versions (thanks to
Michael
+ Fladischer).
Changes in version 0.1
======================
- * First public release.
+ * First public release.
--------
@@ -210,8 +234,8 @@
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2.5
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-picklefield-0.3.1/README
new/django-picklefield-0.3.2/README
--- old/django-picklefield-0.3.1/README 2013-11-15 22:18:40.000000000 +0100
+++ new/django-picklefield-0.3.2/README 1970-01-01 01:00:00.000000000 +0100
@@ -1,197 +0,0 @@
------
-About
------
-
-**django-picklefield** provides an implementation of a pickled object field.
-Such fields can contain any picklable objects.
-
-The implementation is taken and adopted from Django snippet #1694
-<http://www.djangosnippets.org/snippets/1694/> by Taavi Taijala, which is in
-turn based on Django snippet #513 <http://www.djangosnippets.org/snippets/513/>
-by Oliver Beattie.
-
-django-picklefield is available under the MIT license.
-
-
------
-Usage
------
-
-First of all, you need to have **django-picklefield** installed; for your
-convenience, recent versions should be available from PyPI.
-
-To use, just define a field in your model::
-
- >>> from picklefield.fields import PickledObjectField
- ... class SomeObject(models.Model):
- ... args = PickledObjectField()
-
-and assign whatever you like (as long as it's picklable) to the field::
-
- >>> obj = SomeObject()
- >>> obj.args = ['fancy', {'objects': 'inside'}]
- >>> obj.save()
-
-
------
-Notes
------
-
-If you need to serialize an object with a PickledObjectField for transmission
-to the browser, you may need to subclass the field and override the
-``value_to_string()`` method. Currently pickle fields are serialized as
-base64-encoded pickles, which allows reliable deserialization, but such a
-format is not convenient for parsing in the browser. By overriding
-``value_to_string()`` you can choose a more convenient serialization format.
-
---------------
-Original notes
---------------
-
-Here are the notes by taavi223, the original author:
-
-Incredibly useful for storing just about anything in the database (provided it
-is Pickle-able, of course) when there isn't a 'proper' field for the job.
-
-PickledObjectField is database-agnostic, and should work with any database
-backend you can throw at it. You can pass in any Python object and it will
-automagically be converted behind the scenes. You never have to manually pickle
-or unpickle anything. Also works fine when querying; supports exact, in, and
-isnull lookups. It should be noted, however, that calling QuerySet.values()
-will only return the encoded data, not the original Python object.
-
-This PickledObjectField has a few improvements over the one in snippet #513.
-
-This one solves the DjangoUnicodeDecodeError problem when saving an object
-containing non-ASCII data by base64 encoding the pickled output stream. This
-ensures that all stored data is ASCII, eliminating the problem.
-
-PickledObjectField will now optionally use zlib to compress (and uncompress)
-pickled objects on the fly. This can be set per-field using the keyword
-argument "compress=True". For most items this is probably not worth the small
-performance penalty, but for Models with larger objects, it can be a real space
-saver.
-
-You can also now specify the pickle protocol per-field, using the protocol
-keyword argument. The default of 2 should always work, unless you are trying to
-access the data from outside of the Django ORM.
-
-Worked around a rare issue when using the cPickle and performing lookups of
-complex data types. In short, cPickle would sometimes output different streams
-for the same object depending on how it was referenced. This of course could
-cause lookups for complex objects to fail, even when a matching object exists.
-See the docstrings and tests for more information.
-
-You can now use the isnull lookup and have it function as expected. A
-consequence of this is that by default, PickledObjectField has null=True set
-(you can of course pass null=False if you want to change that). If null=False
-is set (the default for fields), then you wouldn't be able to store a Python
-None value, since None values aren't pickled or encoded (this in turn is what
-makes the isnull lookup possible).
-
-You can now pass in an object as the default argument for the field without it
-being converted to a unicode string first. If you pass in a callable though,
-the field will still call it. It will not try to pickle and encode it.
-
-You can manually import dbsafe_encode and dbsafe_decode from fields.py if you
-want to encode and decode objects yourself. This is mostly useful for decoding
-values returned from calling QuerySet.values(), which are still encoded
-strings.
-
-Note: If you are trying to store other django models in the PickledObjectField,
-please see the comments for a discussion on the problems associated with doing
-that. The easy solution is to put django models into a list or tuple before
-assigning them to the PickledObjectField.
-
-Update 9/2/09: Fixed the value_to_string method so that serialization should
-now work as expected. Also added deepcopy back into dbsafe_encode, fixing #4
-above, since deepcopy had somehow managed to remove itself. This means that
-lookups should once again work as expected in all situations. Also made the
-field editable=False by default (which I swear I already did once before!)
-since it is never a good idea to have a PickledObjectField be user editable.
-
--------
-Changes
--------
-
-Changes in version 0.3.1
-========================
-
- * Favor the built in json module (thanks to Simon Charette).
-
-Changes in version 0.3.0
-========================
-
- * Python 3 support (thanks to Rafal Stozek).
-
-Changes in version 0.2.0
-========================
-
- * Allow pickling of subclasses of django.db.models.Model (thanks to Simon
- Charette).
-
-Changes in version 0.1.9
-========================
-
- * Added `connection` and `prepared` parameters to `get_db_prep_value()` too
- (thanks to Matthew Schinckel).
-
-Changes in version 0.1.8
-========================
-
- * Updated link to code repository.
-
-Changes in version 0.1.7
-========================
-
- * Added `connection` and `prepared` parameters to `get_db_prep_lookup()` to
- get rid of deprecation warnings in Django 1.2.
-
-Changes in version 0.1.6
-========================
-
- * Fixed South support (thanks aehlke@github).
-
-Changes in version 0.1.5
-========================
-
- * Added support for South.
- * Changed default to null=False, as is common throughout Django.
-
-Changes in version 0.1.4
-========================
-
- * Updated copyright statements.
-
-Changes in version 0.1.3
-========================
-
- * Updated serialization tests (thanks to Michael Fladischer).
-
-Changes in version 0.1.2
-========================
-
- * Added Simplified BSD licence.
-
-Changes in version 0.1.1
-========================
-
- * Added test for serialization.
- * Added note about JSON serialization for browser.
- * Added support for different pickle protocol versions (thanks to Michael
- Fladischer).
-
-Changes in version 0.1
-======================
-
- * First public release.
-
-
---------
-Feedback
---------
-
-There is a home page <http://github.com/gintas/django-picklefield>
-with instructions on how to access the code repository.
-
-Send feedback and suggestions to [email protected] .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-picklefield-0.3.1/README.rst
new/django-picklefield-0.3.2/README.rst
--- old/django-picklefield-0.3.1/README.rst 1970-01-01 01:00:00.000000000
+0100
+++ new/django-picklefield-0.3.2/README.rst 2015-09-04 01:32:17.000000000
+0200
@@ -0,0 +1,221 @@
+.. image:: https://travis-ci.org/gintas/django-picklefield.svg?branch=master
+ :target: https://travis-ci.org/gintas/django-picklefield
+
+.. image::
https://coveralls.io/repos/gintas/django-picklefield/badge.svg?branch=master&service=github
+ :target:
https://coveralls.io/github/gintas/django-picklefield?branch=master
+
+-----
+About
+-----
+
+**django-picklefield** provides an implementation of a pickled object field.
+Such fields can contain any picklable objects.
+
+The implementation is taken and adopted from `Django snippet #1694`_ by Taavi
+Taijala, which is in turn based on `Django snippet #513`_ by Oliver Beattie.
+
+django-picklefield is available under the MIT license.
+
+.. _Django snippet #1694: http://www.djangosnippets.org/snippets/1694/
+.. _Django snippet #513: http://www.djangosnippets.org/snippets/513/
+
+-----
+Usage
+-----
+
+First of all, you need to have **django-picklefield** installed; for your
+convenience, recent versions should be available from PyPI.
+
+To use, just define a field in your model::
+
+ >>> from picklefield.fields import PickledObjectField
+ ... class SomeObject(models.Model):
+ ... args = PickledObjectField()
+
+and assign whatever you like (as long as it's picklable) to the field::
+
+ >>> obj = SomeObject()
+ >>> obj.args = ['fancy', {'objects': 'inside'}]
+ >>> obj.save()
+
+
+-----
+Notes
+-----
+
+If you need to serialize an object with a PickledObjectField for transmission
+to the browser, you may need to subclass the field and override the
+``value_to_string()`` method. Currently pickle fields are serialized as
+base64-encoded pickles, which allows reliable deserialization, but such a
+format is not convenient for parsing in the browser. By overriding
+``value_to_string()`` you can choose a more convenient serialization format.
+
+-------------
+Running tests
+-------------
+
+The full test suite can be run with `Tox`_::
+
+ >>> pip install tox
+ >>> tox
+
+.. _Tox: https://testrun.org/tox/latest/
+
+--------------
+Original notes
+--------------
+
+Here are the notes by taavi223, the original author:
+
+Incredibly useful for storing just about anything in the database (provided it
+is Pickle-able, of course) when there isn't a 'proper' field for the job.
+
+PickledObjectField is database-agnostic, and should work with any database
+backend you can throw at it. You can pass in any Python object and it will
+automagically be converted behind the scenes. You never have to manually pickle
+or unpickle anything. Also works fine when querying; supports exact, in, and
+isnull lookups. It should be noted, however, that calling QuerySet.values()
+will only return the encoded data, not the original Python object.
+
+This PickledObjectField has a few improvements over the one in snippet #513.
+
+This one solves the DjangoUnicodeDecodeError problem when saving an object
+containing non-ASCII data by base64 encoding the pickled output stream. This
+ensures that all stored data is ASCII, eliminating the problem.
+
+PickledObjectField will now optionally use zlib to compress (and uncompress)
+pickled objects on the fly. This can be set per-field using the keyword
+argument "compress=True". For most items this is probably not worth the small
+performance penalty, but for Models with larger objects, it can be a real space
+saver.
+
+You can also now specify the pickle protocol per-field, using the protocol
+keyword argument. The default of 2 should always work, unless you are trying to
+access the data from outside of the Django ORM.
+
+Worked around a rare issue when using the cPickle and performing lookups of
+complex data types. In short, cPickle would sometimes output different streams
+for the same object depending on how it was referenced. This of course could
+cause lookups for complex objects to fail, even when a matching object exists.
+See the docstrings and tests for more information.
+
+You can now use the isnull lookup and have it function as expected. A
+consequence of this is that by default, PickledObjectField has null=True set
+(you can of course pass null=False if you want to change that). If null=False
+is set (the default for fields), then you wouldn't be able to store a Python
+None value, since None values aren't pickled or encoded (this in turn is what
+makes the isnull lookup possible).
+
+You can now pass in an object as the default argument for the field without it
+being converted to a unicode string first. If you pass in a callable though,
+the field will still call it. It will not try to pickle and encode it.
+
+You can manually import dbsafe_encode and dbsafe_decode from fields.py if you
+want to encode and decode objects yourself. This is mostly useful for decoding
+values returned from calling QuerySet.values(), which are still encoded
+strings.
+
+Note: If you are trying to store other django models in the PickledObjectField,
+please see the comments for a discussion on the problems associated with doing
+that. The easy solution is to put django models into a list or tuple before
+assigning them to the PickledObjectField.
+
+Update 9/2/09: Fixed the value_to_string method so that serialization should
+now work as expected. Also added deepcopy back into dbsafe_encode, fixing #4
+above, since deepcopy had somehow managed to remove itself. This means that
+lookups should once again work as expected in all situations. Also made the
+field editable=False by default (which I swear I already did once before!)
+since it is never a good idea to have a PickledObjectField be user editable.
+
+-------
+Changes
+-------
+
+Changes in version 0.3.2
+========================
+
+* Dropped support for Django 1.3.
+* Dropped support for Python 2.5.
+* Silenced deprecation warnings on Django 1.8+.
+
+Changes in version 0.3.1
+========================
+
+* Favor the built in json module (thanks to Simon Charette).
+
+Changes in version 0.3.0
+========================
+
+* Python 3 support (thanks to Rafal Stozek).
+
+Changes in version 0.2.0
+========================
+
+* Allow pickling of subclasses of django.db.models.Model (thanks to Simon
+ Charette).
+
+Changes in version 0.1.9
+========================
+
+* Added `connection` and `prepared` parameters to `get_db_prep_value()` too
+ (thanks to Matthew Schinckel).
+
+Changes in version 0.1.8
+========================
+
+* Updated link to code repository.
+
+Changes in version 0.1.7
+========================
+
+* Added `connection` and `prepared` parameters to `get_db_prep_lookup()` to
+ get rid of deprecation warnings in Django 1.2.
+
+Changes in version 0.1.6
+========================
+
+* Fixed South support (thanks aehlke@github).
+
+Changes in version 0.1.5
+========================
+
+* Added support for South.
+* Changed default to null=False, as is common throughout Django.
+
+Changes in version 0.1.4
+========================
+
+* Updated copyright statements.
+
+Changes in version 0.1.3
+========================
+
+* Updated serialization tests (thanks to Michael Fladischer).
+
+Changes in version 0.1.2
+========================
+
+* Added Simplified BSD licence.
+
+Changes in version 0.1.1
+========================
+
+* Added test for serialization.
+* Added note about JSON serialization for browser.
+* Added support for different pickle protocol versions (thanks to Michael
+ Fladischer).
+
+Changes in version 0.1
+======================
+
+* First public release.
+
+
+--------
+Feedback
+--------
+
+There is a home page <http://github.com/gintas/django-picklefield>
+with instructions on how to access the code repository.
+
+Send feedback and suggestions to [email protected] .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-picklefield-0.3.1/setup.cfg
new/django-picklefield-0.3.2/setup.cfg
--- old/django-picklefield-0.3.1/setup.cfg 2013-11-15 22:25:57.000000000
+0100
+++ new/django-picklefield-0.3.2/setup.cfg 2015-09-06 19:46:11.000000000
+0200
@@ -1,3 +1,16 @@
+[flake8]
+max-line-length = 119
+
+[isort]
+combine_as_imports = true
+include_trailing_comma = true
+known_third_party = picklefield,south
+multi_line_output = 5
+not_skip = __init__.py
+
+[wheel]
+universal = 1
+
[egg_info]
tag_build =
tag_date = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-picklefield-0.3.1/setup.py
new/django-picklefield-0.3.2/setup.py
--- old/django-picklefield-0.3.1/setup.py 2013-11-15 22:17:12.000000000
+0100
+++ new/django-picklefield-0.3.2/setup.py 2015-09-04 02:00:48.000000000
+0200
@@ -22,32 +22,28 @@
import codecs
from setuptools import setup, find_packages
+long_description = codecs.open('README.rst', encoding='utf-8').read()
-DESC=codecs.open('README', encoding='utf-8').read()
-
-
-setup(name='django-picklefield',
- version='0.3.1',
+setup(
+ name='django-picklefield',
+ version='0.3.2',
description='Pickled object field for Django',
- long_description=DESC,
+ long_description=long_description,
author='Gintautas Miliauskas',
author_email='[email protected]',
url='http://github.com/gintas/django-picklefield',
packages=find_packages('src'),
- package_dir={'' : 'src'},
- install_requires=[
- 'six',
- ],
+ package_dir={'': 'src'},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
- 'Programming Language :: Python :: 2.5',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
+ 'Programming Language :: Python :: 3.4',
]
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-picklefield-0.3.1/src/django_picklefield.egg-info/PKG-INFO
new/django-picklefield-0.3.2/src/django_picklefield.egg-info/PKG-INFO
--- old/django-picklefield-0.3.1/src/django_picklefield.egg-info/PKG-INFO
2013-11-15 22:25:57.000000000 +0100
+++ new/django-picklefield-0.3.2/src/django_picklefield.egg-info/PKG-INFO
2015-09-06 19:45:53.000000000 +0200
@@ -1,25 +1,31 @@
Metadata-Version: 1.1
Name: django-picklefield
-Version: 0.3.1
+Version: 0.3.2
Summary: Pickled object field for Django
Home-page: http://github.com/gintas/django-picklefield
Author: Gintautas Miliauskas
Author-email: [email protected]
License: UNKNOWN
-Description: -----
+Description: .. image::
https://travis-ci.org/gintas/django-picklefield.svg?branch=master
+ :target: https://travis-ci.org/gintas/django-picklefield
+
+ .. image::
https://coveralls.io/repos/gintas/django-picklefield/badge.svg?branch=master&service=github
+ :target:
https://coveralls.io/github/gintas/django-picklefield?branch=master
+
+ -----
About
-----
**django-picklefield** provides an implementation of a pickled object
field.
Such fields can contain any picklable objects.
- The implementation is taken and adopted from Django snippet #1694
- <http://www.djangosnippets.org/snippets/1694/> by Taavi Taijala, which
is in
- turn based on Django snippet #513
<http://www.djangosnippets.org/snippets/513/>
- by Oliver Beattie.
+ The implementation is taken and adopted from `Django snippet #1694`_
by Taavi
+ Taijala, which is in turn based on `Django snippet #513`_ by Oliver
Beattie.
django-picklefield is available under the MIT license.
+ .. _Django snippet #1694: http://www.djangosnippets.org/snippets/1694/
+ .. _Django snippet #513: http://www.djangosnippets.org/snippets/513/
-----
Usage
@@ -52,6 +58,17 @@
format is not convenient for parsing in the browser. By overriding
``value_to_string()`` you can choose a more convenient serialization
format.
+ -------------
+ Running tests
+ -------------
+
+ The full test suite can be run with `Tox`_::
+
+ >>> pip install tox
+ >>> tox
+
+ .. _Tox: https://testrun.org/tox/latest/
+
--------------
Original notes
--------------
@@ -122,77 +139,84 @@
Changes
-------
+ Changes in version 0.3.2
+ ========================
+
+ * Dropped support for Django 1.3.
+ * Dropped support for Python 2.5.
+ * Silenced deprecation warnings on Django 1.8+.
+
Changes in version 0.3.1
========================
- * Favor the built in json module (thanks to Simon Charette).
+ * Favor the built in json module (thanks to Simon Charette).
Changes in version 0.3.0
========================
- * Python 3 support (thanks to Rafal Stozek).
+ * Python 3 support (thanks to Rafal Stozek).
Changes in version 0.2.0
========================
- * Allow pickling of subclasses of django.db.models.Model (thanks to
Simon
- Charette).
+ * Allow pickling of subclasses of django.db.models.Model (thanks to
Simon
+ Charette).
Changes in version 0.1.9
========================
- * Added `connection` and `prepared` parameters to
`get_db_prep_value()` too
- (thanks to Matthew Schinckel).
+ * Added `connection` and `prepared` parameters to
`get_db_prep_value()` too
+ (thanks to Matthew Schinckel).
Changes in version 0.1.8
========================
- * Updated link to code repository.
+ * Updated link to code repository.
Changes in version 0.1.7
========================
- * Added `connection` and `prepared` parameters to
`get_db_prep_lookup()` to
- get rid of deprecation warnings in Django 1.2.
+ * Added `connection` and `prepared` parameters to
`get_db_prep_lookup()` to
+ get rid of deprecation warnings in Django 1.2.
Changes in version 0.1.6
========================
- * Fixed South support (thanks aehlke@github).
+ * Fixed South support (thanks aehlke@github).
Changes in version 0.1.5
========================
- * Added support for South.
- * Changed default to null=False, as is common throughout Django.
+ * Added support for South.
+ * Changed default to null=False, as is common throughout Django.
Changes in version 0.1.4
========================
- * Updated copyright statements.
+ * Updated copyright statements.
Changes in version 0.1.3
========================
- * Updated serialization tests (thanks to Michael Fladischer).
+ * Updated serialization tests (thanks to Michael Fladischer).
Changes in version 0.1.2
========================
- * Added Simplified BSD licence.
+ * Added Simplified BSD licence.
Changes in version 0.1.1
========================
- * Added test for serialization.
- * Added note about JSON serialization for browser.
- * Added support for different pickle protocol versions (thanks to
Michael
- Fladischer).
+ * Added test for serialization.
+ * Added note about JSON serialization for browser.
+ * Added support for different pickle protocol versions (thanks to
Michael
+ Fladischer).
Changes in version 0.1
======================
- * First public release.
+ * First public release.
--------
@@ -210,8 +234,8 @@
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2.5
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-picklefield-0.3.1/src/django_picklefield.egg-info/SOURCES.txt
new/django-picklefield-0.3.2/src/django_picklefield.egg-info/SOURCES.txt
--- old/django-picklefield-0.3.1/src/django_picklefield.egg-info/SOURCES.txt
2013-11-15 22:25:57.000000000 +0100
+++ new/django-picklefield-0.3.2/src/django_picklefield.egg-info/SOURCES.txt
2015-09-06 19:46:11.000000000 +0200
@@ -1,9 +1,9 @@
-README
+README.rst
+setup.cfg
setup.py
src/django_picklefield.egg-info/PKG-INFO
src/django_picklefield.egg-info/SOURCES.txt
src/django_picklefield.egg-info/dependency_links.txt
-src/django_picklefield.egg-info/requires.txt
src/django_picklefield.egg-info/top_level.txt
src/picklefield/__init__.py
src/picklefield/compat.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-picklefield-0.3.1/src/django_picklefield.egg-info/requires.txt
new/django-picklefield-0.3.2/src/django_picklefield.egg-info/requires.txt
--- old/django-picklefield-0.3.1/src/django_picklefield.egg-info/requires.txt
2013-11-15 22:25:57.000000000 +0100
+++ new/django-picklefield-0.3.2/src/django_picklefield.egg-info/requires.txt
1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-six
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-picklefield-0.3.1/src/picklefield/__init__.py
new/django-picklefield-0.3.2/src/picklefield/__init__.py
--- old/django-picklefield-0.3.1/src/picklefield/__init__.py 2012-12-09
10:07:53.000000000 +0100
+++ new/django-picklefield-0.3.2/src/picklefield/__init__.py 2015-09-04
02:02:39.000000000 +0200
@@ -2,4 +2,4 @@
DEFAULT_PROTOCOL = 2
-from picklefield.fields import PickledObjectField # reexport
+from picklefield.fields import PickledObjectField # noqa
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-picklefield-0.3.1/src/picklefield/compat.py
new/django-picklefield-0.3.2/src/picklefield/compat.py
--- old/django-picklefield-0.3.1/src/picklefield/compat.py 2013-11-15
22:15:16.000000000 +0100
+++ new/django-picklefield-0.3.2/src/picklefield/compat.py 2015-09-04
02:02:39.000000000 +0200
@@ -1,18 +1,15 @@
-# django 1.5 introduces force_text instead of force_unicode
-try:
- from django.utils.encoding import force_text
-except ImportError:
- from django.utils.encoding import force_unicode as force_text
+import django
+from django.db import models
+from django.utils import six
# python 3.x does not have cPickle module
try:
- from cPickle import loads, dumps # cpython 2.x
+ # cpython 2.x
+ from cPickle import loads, dumps # noqa
except ImportError:
- from pickle import loads, dumps # cpython 3.x, other interpreters
+ from pickle import loads, dumps # noqa
-# django 1.6 will deprecate django.utils.simple_json
-try:
- import json
-except ImportError:
- from django.utils import simplejson as json
-
+if django.VERSION >= (1, 8):
+ _PickledObjectField = models.Field
+else:
+ _PickledObjectField = six.with_metaclass(models.SubfieldBase, models.Field)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-picklefield-0.3.1/src/picklefield/fields.py
new/django-picklefield-0.3.2/src/picklefield/fields.py
--- old/django-picklefield-0.3.1/src/picklefield/fields.py 2012-12-09
10:12:06.000000000 +0100
+++ new/django-picklefield-0.3.2/src/picklefield/fields.py 2015-09-04
02:10:16.000000000 +0200
@@ -1,13 +1,12 @@
"""Pickle field implementation for Django."""
+from base64 import b64decode, b64encode
from copy import deepcopy
-from base64 import b64encode, b64decode
from zlib import compress, decompress
-import six
-import django
-from django.db import models
-from picklefield import DEFAULT_PROTOCOL
-from picklefield.compat import force_text, loads, dumps
+from django.utils.encoding import force_text
+
+from . import DEFAULT_PROTOCOL
+from .compat import _PickledObjectField, dumps, loads
class PickledObject(str):
@@ -26,10 +25,10 @@
class _ObjectWrapper(object):
"""
- A class used to wrap object that have properties that may clash with the
+ A class used to wrap object that have properties that may clash with the
ORM internals.
-
- For example, objects with the `prepare_database_save` property such as
+
+ For example, objects with the `prepare_database_save` property such as
`django.db.Model` subclasses won't work under certain conditions and the
same apply for trying to retrieve any `callable` object.
"""
@@ -55,28 +54,19 @@
value = dumps(deepcopy(value), protocol=pickle_protocol)
if compress_object:
value = compress(value)
- value = b64encode(value).decode() # decode bytes to str
+ value = b64encode(value).decode() # decode bytes to str
return PickledObject(value)
def dbsafe_decode(value, compress_object=False):
- value = value.encode() # encode str to bytes
+ value = value.encode() # encode str to bytes
value = b64decode(value)
if compress_object:
value = decompress(value)
return loads(value)
-def _get_subfield_superclass():
- # hardcore trick to support django < 1.3 - there was something wrong with
- # inheritance and SubfieldBase before django 1.3
- # see
https://github.com/django/django/commit/222c73261650201f5ce99e8dd4b1ce0d30a69eb4
- if django.VERSION < (1,3):
- return models.Field
- return six.with_metaclass(models.SubfieldBase, models.Field)
-
-
-class PickledObjectField(_get_subfield_superclass()):
+class PickledObjectField(_PickledObjectField):
"""
A field that will accept *any* python object and store it in the
database. PickledObjectField will optionally compress its values if
@@ -86,7 +76,6 @@
can still do lookups using None). This way, it is still possible to
use the ``isnull`` lookup type correctly.
"""
- __metaclass__ = models.SubfieldBase # for django < 1.3
def __init__(self, *args, **kwargs):
self.compress = kwargs.pop('compress', False)
@@ -140,6 +129,9 @@
value = super(PickledObjectField, self).pre_save(model_instance, add)
return wrap_conflictual_object(value)
+ def from_db_value(self, value, expression, connection, context):
+ return self.to_python(value)
+
def get_db_prep_value(self, value, connection=None, prepared=False):
"""
Pickle and b64encode the object, optionally compressing it.
@@ -162,7 +154,7 @@
return value
def value_to_string(self, obj):
- value = self._get_val_from_obj(obj)
+ value = self.value_from_object(obj)
return self.get_db_prep_value(value)
def get_internal_type(self):
@@ -173,14 +165,9 @@
raise TypeError('Lookup type %s is not supported.' % lookup_type)
# The Field model already calls get_db_prep_value before doing the
# actual lookup, so all we need to do is limit the lookup types.
- try:
- return super(PickledObjectField, self).get_db_prep_lookup(
- lookup_type, value, connection=connection, prepared=prepared)
- except TypeError:
- # Try not to break on older versions of Django, where the
- # `connection` and `prepared` parameters are not available.
- return super(PickledObjectField, self).get_db_prep_lookup(
- lookup_type, value)
+ return super(PickledObjectField, self).get_db_prep_lookup(
+ lookup_type, value, connection=connection, prepared=prepared
+ )
# South support; see
http://south.aeracode.org/docs/tutorial/part4.html#simple-inheritance
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-picklefield-0.3.1/src/picklefield/tests.py
new/django-picklefield-0.3.2/src/picklefield/tests.py
--- old/django-picklefield-0.3.1/src/picklefield/tests.py 2012-12-09
10:12:06.000000000 +0100
+++ new/django-picklefield-0.3.2/src/picklefield/tests.py 2015-09-04
02:10:16.000000000 +0200
@@ -1,12 +1,11 @@
"""Unit tests for django-picklefield."""
+import json
-from django.test import TestCase
-from django.db import models
from django.core import serializers
-from picklefield.compat import json
-from picklefield.fields import (PickledObjectField, wrap_conflictual_object,
- dbsafe_encode)
+from django.db import models
+from django.test import TestCase
+from .fields import PickledObjectField, dbsafe_encode, wrap_conflictual_object
S1 = 'Hello World'
T1 = (1, 2, 3, 4, 5)
@@ -42,14 +41,13 @@
the database, whether compression is enabled or not.
"""
for value in self.testing_data:
- model_test = TestingModel(pickle_field=value,
- compressed_pickle_field=value)
+ model_test = TestingModel(pickle_field=value,
compressed_pickle_field=value)
model_test.save()
model_test = TestingModel.objects.get(id__exact=model_test.id)
# Make sure that both the compressed and uncompressed fields return
# the same data, even thought it's stored differently in the DB.
- self.assertEquals(value, model_test.pickle_field)
- self.assertEquals(value, model_test.compressed_pickle_field)
+ self.assertEqual(value, model_test.pickle_field)
+ self.assertEqual(value, model_test.compressed_pickle_field)
# Make sure we can also retrieve the model
model_test.save()
model_test.delete()
@@ -59,8 +57,7 @@
model_test = TestingModel()
model_test.save()
model_test = TestingModel.objects.get(id__exact=model_test.id)
- self.assertEquals((D1, S1, T1, L1),
- model_test.default_pickle_field)
+ self.assertEqual((D1, S1, T1, L1), model_test.default_pickle_field)
def testLookups(self):
"""
@@ -116,7 +113,7 @@
>>> dumps(copy(t))
"((dp1\nI1\nI1\nsI2\nI4\nsI3\nI6\nsI4\nI8\nsI5\nI10\nsS'Hello
World'\n(I1\nI2\nI3\nI4\nI5\nt(lp2\nI1\naI2\naI3\naI4\naI5\natp3\n."
- """
+ """ # noqa
for value in self.testing_data:
model_test = TestingModel(pickle_field=value,
compressed_pickle_field=value)
model_test.save()
@@ -125,16 +122,16 @@
wrapped_value = wrap_conflictual_object(value)
model_test =
TestingModel.objects.get(pickle_field__exact=wrapped_value,
compressed_pickle_field__exact=wrapped_value)
- self.assertEquals(value, model_test.pickle_field)
- self.assertEquals(value, model_test.compressed_pickle_field)
+ self.assertEqual(value, model_test.pickle_field)
+ self.assertEqual(value, model_test.compressed_pickle_field)
# Make sure that ``in`` lookups also work correctly.
model_test =
TestingModel.objects.get(pickle_field__in=[wrapped_value],
compressed_pickle_field__in=[wrapped_value])
- self.assertEquals(value, model_test.pickle_field)
- self.assertEquals(value, model_test.compressed_pickle_field)
+ self.assertEqual(value, model_test.pickle_field)
+ self.assertEqual(value, model_test.compressed_pickle_field)
# Make sure that ``is_null`` lookups are working.
- self.assertEquals(1,
TestingModel.objects.filter(pickle_field__isnull=False).count())
- self.assertEquals(0,
TestingModel.objects.filter(pickle_field__isnull=True).count())
+ self.assertEqual(1,
TestingModel.objects.filter(pickle_field__isnull=False).count())
+ self.assertEqual(0,
TestingModel.objects.filter(pickle_field__isnull=True).count())
model_test.delete()
# Make sure that lookups of the same value work, even when referenced
@@ -144,17 +141,17 @@
model_test.save()
# Test lookup using an assigned variable.
model_test = TestingModel.objects.get(pickle_field__exact=value)
- self.assertEquals(value, model_test.pickle_field)
+ self.assertEqual(value, model_test.pickle_field)
# Test lookup using direct input of a matching value.
model_test = TestingModel.objects.get(
- pickle_field__exact = (D1, S1, T1, L1),
- compressed_pickle_field__exact = (D1, S1, T1, L1),
+ pickle_field__exact=(D1, S1, T1, L1),
+ compressed_pickle_field__exact=(D1, S1, T1, L1),
)
- self.assertEquals(value, model_test.pickle_field)
+ self.assertEqual(value, model_test.pickle_field)
model_test.delete()
def testSerialization(self):
- model = MinimalTestingModel(pickle_field={'foo': 'bar'})
+ model = MinimalTestingModel(pk=1, pickle_field={'foo': 'bar'})
serialized = serializers.serialize('json', [model])
data = json.loads(serialized)
@@ -162,10 +159,11 @@
# is different (but compatible with python 2)
p = dbsafe_encode({'foo': 'bar'})
- self.assertEquals(data,
- [{'pk': None, 'model': 'picklefield.minimaltestingmodel',
- 'fields': {"pickle_field": p}}])
+ self.assertEqual(data, [{
+ 'pk': 1,
+ 'model': 'picklefield.minimaltestingmodel',
+ 'fields': {"pickle_field": p}},
+ ])
for deserialized_test in serializers.deserialize('json', serialized):
- self.assertEquals(deserialized_test.object,
- model)
+ self.assertEqual(deserialized_test.object, model)