Closed GoogleCodeExporter closed 8 years ago
Here's the proposed patch, it's *very* simple.
Thanks,
Clint
Original comment by her...@gmail.com
on 1 Dec 2010 at 5:46
Attachments:
Just curious... What version of Django are you using? How was it installed?
Based on my research into the Django source, you shouldn't get the "No module
named encoder" error when Django is newer than June 2006 (see the history on
the file at
https://github.com/django/django/commits/master/django/utils/simplejson/encoder.
py). Considering that the history of the __init__.py file looks pretty similar
(https://github.com/django/django/commits/master/django/utils/simplejson/__init_
_.py), I suspect your Django installation is a little broken.
I don't quite feel comfortable making this change until I better understand the
problem. Would you mind doing a little more digging into the structure of your
Django installation please?
Original comment by wheaties...@gmail.com
on 27 Dec 2010 at 5:46
Hi, thank you for getting back on this ticket. I am using Fedora 14 and have
installed the latest rpm version of Django and django-tracking. Here's a dump
of my installation information.
$ rpm -q django-tracking
django-tracking-0.2.7-1.fc14.noarch
[clints@x201 ~]$ rpm -q Django
Django-1.2.3-1.fc14.noarch
[clints@x201 ~]$ rpm -V django-tracking
S.5....T. /usr/lib/python2.7/site-packages/tracking/views.py
The above are the versions of the packages I'm using on Fedora 14 (python
2.6/2.7 depending on preference).
In Fedora, it appears they chose to simply use the existing simplejson which is
provided at https://code.google.com/p/simplejson. Then within the
django/utils/simplejson/__init__.py, they simply just import the simplejson
library like so:
$ less __init__.py
r"""
Stub simplejson library that just imports the version provided by the system
"""
from simplejson import *
----
From this, I believe the 'from django.utils.simplejson.encoder import
JSONEncoder' should work, but I think it actually imports everything inside
encoder, decoder, etc. Which is why the import I do doesn't accomplish the
same thing your import does. It might be that I need to alter the
django-tracking rpm to accommodate the Fedora setup, but it does seem to me
that there's some overlap. The choices made by the folks in the django
community to just include simplejson into their tree seem odd to me, but that's
just my perspective.
What suggestions might you make? Would requiring the simplejson library
instead of the django.utils.simplejson library be something that you could
accommodate? It works fine from my minimal testing.
Thanks,
Clint
Original comment by her...@gmail.com
on 27 Dec 2010 at 11:09
Interesting find. Based on what you've shared, I see no harm in applying your
fix. I think it's silly that Fedora is packaging anything other than a vanilla
Django package, but that's not my problem. Your solution appears to be
compatible with Fedora's package as well as the standard Django offerings.
I do have a suggestion, though: don't rely on django or django-tracking
(probably any/all of the other django-*) packages offered by Fedora's (or
Ubuntu's or whatever's) package manager. Use pip or easy_install :D
Original comment by wheaties...@gmail.com
on 28 Dec 2010 at 1:27
Fixed in 3acb164942ee
Original comment by wheaties...@gmail.com
on 28 Dec 2010 at 1:32
Original issue reported on code.google.com by
her...@gmail.com
on 1 Dec 2010 at 5:42