Bug 464885 - Django includes a local copy of simplejson
Django includes a local copy of simplejson
Status: CLOSED NEXTRELEASE
Product: Fedora
Classification: Fedora
Component: Django (Show other bugs)
10
All Linux
medium Severity high
: ---
: ---
Assigned To: Michel Alexandre Salim
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-09-30 21:30 EDT by Toshio Ernie Kuratomi
Modified: 2008-12-30 18:55 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-12-30 18:45:21 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Toshio Ernie Kuratomi 2008-09-30 21:30:37 EDT
Description of problem:
Django includes a local copy of simplejson:

/usr/lib/python2.5/site-packages/django/utils/simplejson/

django needs to use the system simplejson instead.  This is described in the following guideline:

http://fedoraproject.org/wiki/Packaging/Guidelines#Duplication_of_system_libraries

Version-Release number of selected component (if applicable):
1.0-1
Comment 1 Steve Milner 2008-11-01 22:47:11 EDT
Here is a quick list of what is using the snapshot simplejson inside of Django ...

[steve@tachikoman django]$ pwd
/usr/lib/python2.5/site-packages/django
[steve@tachikoman django]$ grep -r "simplejson" * | grep -v Binary
core/serializers/json.py:from django.utils import simplejson
core/serializers/json.py:        simplejson.dump(self.objects, self.stream, cls=DjangoJSONEncoder, **self.options)
core/serializers/json.py:    for obj in PythonDeserializer(simplejson.load(stream)):
core/serializers/json.py:class DjangoJSONEncoder(simplejson.JSONEncoder):
test/testcases.py:from django.utils import simplejson
test/testcases.py:            want_json = simplejson.loads(want)
test/testcases.py:            got_json = simplejson.loads(got)
utils/simplejson/encoder.py:    from django.utils.simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii
utils/simplejson/tool.py:Using simplejson from the shell to validate and
utils/simplejson/tool.py:    $ echo '{"json":"obj"}' | python -msimplejson
utils/simplejson/tool.py:    $ echo '{ 1.2:3.4}' | python -msimplejson
utils/simplejson/tool.py:import django.utils.simplejson
utils/simplejson/tool.py:#     curl http://mochikit.com/examples/ajax_tables/domains.json | python -msimplejson.tool
utils/simplejson/tool.py:        obj = simplejson.load(infile)
utils/simplejson/tool.py:    simplejson.dump(obj, outfile, sort_keys=True, indent=4)
utils/simplejson/__init__.py:simplejson exposes an API familiar to uses of the standard library
utils/simplejson/__init__.py:    >>> import simplejson
utils/simplejson/__init__.py:    >>> simplejson.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
utils/simplejson/__init__.py:    >>> print simplejson.dumps("\"foo\bar")
utils/simplejson/__init__.py:    >>> print simplejson.dumps(u'\u1234')
utils/simplejson/__init__.py:    >>> print simplejson.dumps('\\')
utils/simplejson/__init__.py:    >>> print simplejson.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)
utils/simplejson/__init__.py:    >>> simplejson.dump(['streaming API'], io)
utils/simplejson/__init__.py:    >>> import simplejson
utils/simplejson/__init__.py:    >>> simplejson.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':'))
utils/simplejson/__init__.py:    >>> import simplejson
utils/simplejson/__init__.py:    >>> print simplejson.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)
utils/simplejson/__init__.py:    >>> import simplejson
utils/simplejson/__init__.py:    >>> simplejson.loads('["foo", {"bar":["baz", null, 1.0, 2]}]')
utils/simplejson/__init__.py:    >>> simplejson.loads('"\\"foo\\bar"')
utils/simplejson/__init__.py:    >>> simplejson.load(io)
utils/simplejson/__init__.py:    >>> import simplejson
utils/simplejson/__init__.py:    >>> simplejson.loads('{"__complex__": true, "real": 1, "imag": 2}',
utils/simplejson/__init__.py:    >>> simplejson.loads('1.1', parse_float=decimal.Decimal)
utils/simplejson/__init__.py:    >>> import simplejson
utils/simplejson/__init__.py:    >>> class ComplexEncoder(simplejson.JSONEncoder):
utils/simplejson/__init__.py:    ...         return simplejson.JSONEncoder.default(self, obj)
utils/simplejson/__init__.py:Using simplejson from the shell to validate and
utils/simplejson/__init__.py:    $ echo '{"json":"obj"}' | python -msimplejson.tool
utils/simplejson/__init__.py:    $ echo '{ 1.2:3.4}' | python -msimplejson.tool
utils/simplejson/__init__.py:    warnings.warn('python -msimplejson is deprecated, use python -msiplejson.tool', DeprecationWarning)
utils/simplejson/__init__.py:    from django.utils.simplejson.decoder import JSONDecoder
utils/simplejson/__init__.py:    from django.utils.simplejson.encoder import JSONEncoder
utils/simplejson/__init__.py:    warnings.warn("simplejson.loads(s) should be used instead of decode(s)",
utils/simplejson/__init__.py:    warnings.warn("simplejson.dumps(s) should be used instead of encode(s)",
utils/simplejson/__init__.py:    warnings.warn("simplejson.loads(s) should be used instead of read(s)",
utils/simplejson/__init__.py:    warnings.warn("simplejson.dumps(s) should be used instead of write(s)",
utils/simplejson/__init__.py:    import simplejson.tool
utils/simplejson/__init__.py:    simplejson.tool.main()
utils/simplejson/decoder.py:from django.utils.simplejson.scanner import Scanner, pattern
utils/simplejson/decoder.py:    from django.utils.simplejson._speedups import scanstring as c_scanstring

one issue I see here is that people may be using "from django.utils import simplejson". To keep apps that use django.utils.simplejson from not working would a link be ok so that it points to the site-lib version of simplejson? Other than that I don't think it will be tough for me or someone else to jump in and patch out the usage internally.
Comment 2 Toshio Ernie Kuratomi 2008-11-02 10:52:54 EST
In the python-py review we ran into a similar issue.  To keep the public interface compatible the packager and upstream decided to import the module.

So something like:

rm -rf simplejson/*
echo 'from simplejson import *' > simplejson/__init__.py


Patching the simplejson imports to be like this:

try:
    import simplejson
except ImportError:
    from django.utils import simplejson

Would hopefully be amenable to upstream.
Comment 3 Bug Zapper 2008-11-25 22:18:16 EST
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 4 Fedora Update System 2008-12-14 13:14:45 EST
Django-1.0.2-1.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/Django-1.0.2-1.fc10
Comment 5 Fedora Update System 2008-12-14 13:15:01 EST
Django-1.0.2-1.fc9 has been submitted as an update for Fedora 9.
http://admin.fedoraproject.org/updates/Django-1.0.2-1.fc9
Comment 6 Fedora Update System 2008-12-14 13:15:06 EST
Django-1.0.2-1.fc8 has been submitted as an update for Fedora 8.
http://admin.fedoraproject.org/updates/Django-1.0.2-1.fc8
Comment 7 Fedora Update System 2008-12-17 19:41:07 EST
Django-1.0.2-1.fc8 has been pushed to the Fedora 8 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing-newkey update Django'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F8/FEDORA-2008-11363
Comment 8 Fedora Update System 2008-12-17 19:42:47 EST
Django-1.0.2-1.fc9 has been pushed to the Fedora 9 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing-newkey update Django'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F9/FEDORA-2008-11368
Comment 9 Fedora Update System 2008-12-17 19:43:39 EST
Django-1.0.2-1.fc10 has been pushed to the Fedora 10 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update Django'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F10/FEDORA-2008-11325
Comment 10 Fedora Update System 2008-12-30 18:45:11 EST
Django-1.0.2-1.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 11 Fedora Update System 2008-12-30 18:46:08 EST
Django-1.0.2-1.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 12 Fedora Update System 2008-12-30 18:55:05 EST
Django-1.0.2-1.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.