Closed Bug 1170160 Opened 9 years ago Closed 9 years ago

make sure django-waffle works with django-jinja

Categories

(Input Graveyard :: Code Quality, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: willkg, Assigned: willkg)

References

Details

(Whiteboard: u=dev c=codequality p= s=input.2015q3)

As part of our upgrade to Django 1.8, we're ditching jingo (bug #1167194). django-waffle uses jingo for something.

We need to:

1. make sure the version of django-waffle we're using works with Django 1.8
2. see if django-waffle *requires* jingo (pretty sure it doesn't) and if so, fix it
3. add whatever infrastructure to fjord that we need to make sure we can do django-waffle things in templates with django-jinja
Talked with Ricky about this on IRC. I wrote up an issue in the django-waffle tracker:

https://github.com/jsocol/django-waffle/issues/166

I suspect we just need to add the django-waffle global functions. So it should be pretty easy to do. He said he's game for us doing that as a PR.

I can grab this if you want.
This worked for me with the ref app:
https://github.com/jsocol/django-waffle/compare/master...rlr:django-jinja2

Does that look OK? Tests are passing.

Docs need to be updated.

And it would need to be tested somehow. Django 1.8 isn't configured in the tox.ini yet.  Is it fair to assume that django v>=1.8 will be using django-jinja and v<1.8 will be jingo?
That looks fine to me. My only issue is that instead of having two separate try/except blocks, I'd have one cascade into the other. e.g.:

try:
    import jingo
    # jingo thing
except ImportError:
    try:
        import django_jinja
        # django_jinja thing
    except ImportError:
        pass

We also need to:

1. update the django-waffle docs
2. add appropriate tests

I can do that aspect of things if you like.

Regarding Django 1.8 and all that, I'm not sure if anyone is using django-waffle with django-jinja and django < 1.8. I think it's probably unlikely given that there wasn't any overt support for it.

I also don't know if people will be using Django 1.8 with jingo.

I think the safer bet is to not assume here and just test the variety of cases.

I didn't realize django-waffle didn't have django 1.8 stuff, yet. If we were meticulous, I think we'd do a PR for django 1.8 stuff. Then follow that up with a PR for django-jinja support.
I'll run with this.
Assignee: nobody → rrosario
This is important--making it a P2.
Status: NEW → ASSIGNED
Priority: -- → P2
The PR for django-waffle hasn't landed, yet. I'll follow up with James next week about that.

In the meantime, I'm putting this in 2015q3.
Whiteboard: u=dev c=codequality p= s=input.2015q2 → u=dev c=codequality p= s=input.2015q3
I added a note to the django-waffle PR. I grabbed Ricky's branch and pulled it into my own fork of the django-waffle repository. I'm going to switch Fjord to use that until the PR lands.

Grabbing this one to finish it off.
Assignee: rrosario → willkg
Landed in https://github.com/mozilla/fjord/commit/fab8b91f53db4d50f28005c16711e77f19f8cee3

Pushed to stage. Then I ran the smoketests. Everything seems good.

Pushed to prod just now.

Thank you Ricky for doing all the hard work here!
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
See Also: → 1225584
Product: Input → Input Graveyard
You need to log in before you can comment on or make changes to this bug.