jbalogh / jingo

An adapter for using Jinja2 templates with Django.
http://readthedocs.org/docs/jingo/en/latest/
BSD 3-Clause "New" or "Revised" License
178 stars 45 forks source link

Updated to work around StrAndUnicode removal in 1.7 (fixes #61) #62

Closed robhudson closed 9 years ago

robhudson commented 9 years ago

r? @jsocol or @davedash ? Pretty please with a :cherries: on top?

jsocol commented 9 years ago

I will take a look this weekend. I'm sorry I can't get it sooner.

jsocol commented 9 years ago

I'm not 100% sure the monkeypatch is needed in 1.7, since Django started supporting the __html__ protocol. I need to dig into that. If we don't need it, we don't need to fix the monkeypatch, just document the change.

robhudson commented 9 years ago

Updated based on comments.

I can play with zamboni under Django 1.7 and without the monkey patch. I agree, it looks like it isn't needed now that there's this.

robhudson commented 9 years ago

Turns out the monkey patching is still needed. I found cases where forms rendered incorrectly without it. I didn't dig much further than that.

jsocol commented 9 years ago

Can you post the cases you found? I'll dig more this weekend but I want to understand why the code has to be there. 

Sent from my phone, please excuse the occasional typo.

On Tue, Oct 21, 2014 at 7:15 PM, Rob Hudson notifications@github.com wrote:

Turns out the monkey patching is still needed. I found cases where forms rendered incorrectly without it. I didn't dig much further than that.

Reply to this email directly or view it on GitHub: https://github.com/jbalogh/jingo/pull/62#issuecomment-60014159

robhudson commented 9 years ago

I simply commented out the monkey patch and loaded a view with a form in zamboni and saw a bunch of unrendered HTML for the form elements. I'd have to look at how SafeData is used in django to understand better what's going on.

robhudson commented 9 years ago

I'm wondering if we can get this merged?

jsocol commented 9 years ago

OK, I think I see what's happening: if StrAndUnicode isn't there, then only the last 3 lines matter because, for some reason, some classes there don't have the __html__ method.

I'm going to merge this as-is but eventually I'd like to not have the extra class with the runtime basis. Python is cray but that's a little far.