Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 and Django 1.5 support #308

Merged
merged 10 commits into from Feb 27, 2013
Merged

Python 3 and Django 1.5 support #308

merged 10 commits into from Feb 27, 2013

Conversation

fhahn
Copy link
Contributor

@fhahn fhahn commented Feb 24, 2013

Pull request for #288

I've added Python 3 support using six, which I added to install_requires.

I couldn't find any information about the supported python versions of django-extensions, but if 2.6 is required at least (there are no entries with a version < 2.6 in tox.ini), then we could remove utils/uuid.py

@trbs
Copy link
Member

trbs commented Feb 24, 2013

Great ! Thanks for the work on this.

I will try to make time this week to merge this and do a new release so people can start testing with Python 3 and Django 1.5.

@fhahn
Copy link
Contributor Author

fhahn commented Feb 25, 2013

I stumbled over a problem when running the tests for python 3 on travis-ci because python-keyczar is not compatible with python 3, but is always installed. Any suggestions how to handle this problem? Skip installing python-keyczar for python 3?

@trbs
Copy link
Member

trbs commented Feb 25, 2013

Yes fine with me, we can skip keyczar if they become py3 enabled we can always install it again.

@fhahn
Copy link
Contributor Author

fhahn commented Feb 25, 2013

Okay, I'll look into that tomorrow. I think I should add a couple of basic tests for all the management commands, because some are untested.

@trbs
Copy link
Member

trbs commented Feb 25, 2013

Great thanks ! I hope to get some time this week to start testing and
helping as well.

On Mon, Feb 25, 2013 at 11:20 PM, Florian Hahn notifications@github.comwrote:

Okay, I'll look into that tomorrow. I think I should add a couple of basic
tests for all the management commands, because some are untested.


Reply to this email directly or view it on GitHubhttps://github.com//pull/308#issuecomment-14079808.

trbs added a commit that referenced this pull request Feb 27, 2013
Python 3 and Django 1.5 support
@trbs trbs merged commit 4a228d9 into django-extensions:master Feb 27, 2013
@andreasnuesslein
Copy link

Hm. When trying to build this either directly from source with python setup.py install or via pip, I still get multiple errors.
They are too many to paste them all here, but it's a bunch of u'text' and one 32L.

@fhahn is it working for you now?

@trbs
Copy link
Member

trbs commented May 3, 2013

Could you pastebin or gist it maybe ?

Also I'm wondering why the build errors do not show up on travis...
https://travis-ci.org/django-extensions/django-extensions

Are you using python3.3 ? cause I'm not sure if we actually support lower then 3.3 for py3k.

@andreasnuesslein
Copy link

http://pastebin.com/dCXiEuPA

actually it's python3.2, but I don't think they re-added u'text' to python3.3, did they?

@trbs
Copy link
Member

trbs commented May 3, 2013

They did.

http://docs.python.org/3.3/whatsnew/3.3.html

  • The u'unicode' syntax is accepted again for str objects.

@andreasnuesslein
Copy link

Hah! .. What do you know! :) Okay my bad.
Thank you for your quick response!

@trbs
Copy link
Member

trbs commented May 3, 2013

No problem.

I hope you can easily update to Python 3.3.
Otherwise if u'text' is the only problem it should be fixed pretty easily with six.u

@andreasnuesslein
Copy link

Hm. Gentoo has still masked 3.3, but I actually have a bunch of other things in my pipeline and as django_extensions was 'only' a nice-to-have, I'm concentrating on other stuff and wait for Gentoo to update ;)
Thanks again

trbs added a commit that referenced this pull request May 3, 2013
@trbs
Copy link
Member

trbs commented May 3, 2013

I can complete run_tests.py with python3.2 and compileall.compile_dir with the latest change.

(have to skip django_extensions/utils/uuid.py since that's a fallback for python2.4)

Could you check with the git development version ?

@andreasnuesslein
Copy link

Heh! Nice 👍

One error remaining, when trying to run python setup.py install:

Extracting django_extensions-1.1.2-py3.2.egg to /home/nutz/.virtualenvs/umgmt/lib/python3.2/site-packages
  File "/home/nutz/.virtualenvs/umgmt/lib/python3.2/site-packages/django_extensions-1.1.2-py3.2.egg/django_extensions/utils/uuid.py", line 153
    if not 0 <= time_low < 1 << 32L:
                                  ^
SyntaxError: invalid syntax

trbs added a commit that referenced this pull request May 3, 2013
@trbs
Copy link
Member

trbs commented May 3, 2013

I removed the uuid module. Could you try again ? It should work now.

@andreasnuesslein
Copy link

perfect it works like a charm :) thanks a lot!

@rcooke
Copy link

rcooke commented Jul 19, 2013

Argh! I forked so I could add and test a patch to use the Admin.queryset with autolookups. But when I try to run on Django 1.5.1 and Python 2.7.4 I get this error which has a "six.u" in admin.widgets. Is this part of this change?

Traceback:
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  140.                     response = response.render()
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/response.py" in render
  105.             self.content = self.rendered_content
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/response.py" in rendered_content
  82.         content = template.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/base.py" in render
  140.             return self._render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
  65.     return self.nodelist.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/base.py" in render
  830.                 bit = self.render_node(node, context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/debug.py" in render_node
  74.             return node.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  124.         return compiled_parent._render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
  65.     return self.nodelist.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/base.py" in render
  830.                 bit = self.render_node(node, context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/debug.py" in render_node
  74.             return node.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  124.         return compiled_parent._render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
  65.     return self.nodelist.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/base.py" in render
  830.                 bit = self.render_node(node, context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/debug.py" in render_node
  74.             return node.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  63.             result = block.nodelist.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/base.py" in render
  830.                 bit = self.render_node(node, context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/debug.py" in render_node
  74.             return node.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  63.             result = block.nodelist.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/base.py" in render
  830.                 bit = self.render_node(node, context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/debug.py" in render_node
  74.             return node.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  188.                         nodelist.append(node.render(context))
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  156.         return self.render_template(self.template, context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/loader_tags.py" in render_template
  138.         output = template.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/base.py" in render
  140.             return self._render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
  65.     return self.nodelist.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/base.py" in render
  830.                 bit = self.render_node(node, context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/debug.py" in render_node
  74.             return node.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  367.         return strip_spaces_between_tags(self.nodelist.render(context).strip())
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/base.py" in render
  830.                 bit = self.render_node(node, context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/debug.py" in render_node
  74.             return node.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  188.                         nodelist.append(node.render(context))
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  188.                         nodelist.append(node.render(context))
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  284.                 return nodelist.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/base.py" in render
  830.                 bit = self.render_node(node, context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/debug.py" in render_node
  74.             return node.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  284.                 return nodelist.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/base.py" in render
  830.                 bit = self.render_node(node, context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/debug.py" in render_node
  74.             return node.render(context)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/template/debug.py" in render
  87.             output = force_text(output)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/utils/encoding.py" in force_text
  99.                 s = s.__unicode__()
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/forms/forms.py" in __str__
  411.         return self.as_widget()
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/forms/forms.py" in as_widget
  458.         return widget.render(name, self.value(), attrs=attrs)
File "/home/rcooke/.virtualenvs/django15/lib/python2.7/site-packages/django/contrib/admin/widgets.py" in render
  263.         output = [self.widget.render(name, value, *args, **kwargs)]
File "/home/rcooke/django-extensions/django_extensions/admin/widgets.py" in render
  96.         return mark_safe(six.u(''.join(output)))
File "/usr/lib/python2.7/dist-packages/six.py" in u
  275.         return unicode(s, "unicode_escape")

Exception Type: TypeError at /admin/purchasing/po/3/
Exception Value: decoding Unicode is not supported

@radiosilence
Copy link

Also getting the above error :/

@radiosilence
Copy link

This is a problem with six, I've raised an issue.

Basically replicate by doing:

import six; six.u(u'bawbag')

@trbs
Copy link
Member

trbs commented Nov 4, 2013

Could you please try with the latest version (or git version) of django_extensions ?

In changeset 550c292 there was a patch which I think solves this issue from our side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants