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

Compat for Django 1.9 and 1.10 #81

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

thomasgoirand
Copy link

Hi there!

I'm the package maintainer of python-jingo in Debian. I maintain it, because it's a build-dependency of python-django-compressor, which is itself used by OpenStack Horizon (the OpenStack dashboard), and I maintain all packages for OpenStack in Debian.

As we're going to ship Debian 9 (aka: Stretch, which we will freeze a the end of the year) with Django 1.10, we are already extensively testing and making sure that all of our packages are Django 1.10 ready. Therefore, we're testing them against the beta1 release of Django (which is currently in Debian Experimental).

I have therefore written a few patches for Jingo to support Django 1.10. As much as I can tell, you guys aren't even supporting Django 1.9, which is already old (more than 6 months). I have rebuilt the package in both Django 1.9 and 1.10 env, and all unit tests are passing. Well, all but:

  • test_render_django
  • test_render_django_no_toplevel_override
  • test_render_django_toplevel_override

I haven't figured out yet how to fix these in Django 1.9 / 1.10, and I'm not much interested in it, because it looks like only fixing the unit tests themselves. However, if you can come with a patch, I'd love to use it.

Best would be if you could release a new version of Jingo with this pull request, plus the fix of the 3 unit tests above which are failing. In such case, please let me know (I'm zigo on Freenode and OFTC), and I'll make sure your new upstream release ends up in Debian Stretch.

Hoping this pull request helps,

Thomas Goirand (zigo)

TemplateDoesNotExist is a private function that should never be used.
In Django 1.9, upstream authors decided to move it to another path.
This patch defines TemplateDoesNotExist directly in jingo instead of
using the internal Django version.
This patch adds a call to django.setup() which is now needed in Django.
Django 1.9 removed django.utils.six. Jingo then should use six
directly, not from Django.
In Django 1.10, django.template.loader.BaseLoader is removed completely.
This patch uses django.template.loaders.base.Loader instead.
In Django 1.10, we need to add this to INSTALLED_APPS:
    django.contrib.sites
    django.contrib.contenttypes
    django.contrib.auth

Without this, unit tests are failing over with not-found templates.
In Django 1.10, many things which were previously declared separatly
now have to go in a TEMPLATES = [] object.
In Django 1.10, settings.TEMPLATE_DEBUG. Instead, we should use
settings.TEMPLATES[0]['OPTIONS']['debug'].
In Django 1.10, django.forms.util was renamed django.forms.utils
(deprecation cycle ended, and there's no fallback).
In Django 1.10, the __init__() method of the Loader class takes
2 args, not 1 anymore. This patch fixes that.
In Django 1.10, django.conf.urls.patterns (and its associated function)
doesn't exist anymore, and we *must* use url(), not just () for the
urlpatterns tuples.
django.template.loaders.base doesn't exist in Django 1.7. This patch
makes the Django 1.10 to continue to work with older version.
@jsocol
Copy link
Collaborator

jsocol commented Jul 25, 2016

@thomasgoirand as the only remaining maintainer of jingo, I've EOLed the project, as noted in the README. I've moved my projects to django-jinja and recommend others do the same. I won't be doing any additional releases of jingo.

If you're interested in taking over maintenance of the project let me know, I can give you access to PyPI and we can direct people to your fork. Alternatively, you can always fork the project under a new name.

If you do want to pick up maintenance, I'd recommend only supporting currently-supported Django versions, i.e. 1.8–1.10. It helps a lot.

Previous commit uses six, not from Django. This patch adds six
as runtime requires.
Previous commit added a 2nd param for the __init__ of the Loader
class. However, this broke compat with older version of Django.
This patch solves that by making this 2nd parameter optional.
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.

2 participants