Bug 464885

Summary: Django includes a local copy of simplejson
Product: [Fedora] Fedora Reporter: Toshio Ernie Kuratomi <a.badger>
Component: DjangoAssignee: Michel Lind <michel>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: medium    
Version: 10CC: michel, smilner
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-12-30 23:45:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Toshio Ernie Kuratomi 2008-10-01 01:30:37 UTC
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-02 02:47:11 UTC
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 15:52:54 UTC
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-26 03:18:16 UTC
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 18:14:45 UTC
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 18:15:01 UTC
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 18:15:06 UTC
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-18 00:41:07 UTC
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-18 00:42:47 UTC
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-18 00:43:39 UTC
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 23:45:11 UTC
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 23:46:08 UTC
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 23:55:05 UTC
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.