django-template-previewer
django-template-previewer copied to clipboard
Make it work with the currently supported Django (1.8, 1.9, 1.10) & python (2/3) versions
Also added regression tests for the things that had to be fixed during the upgrade
Wow, this is an amazing and welcome work. I haven't been working this for some time, so I'll try to find some time next week to catch up and review. Thanks!
On Tue, Aug 23, 2016 at 10:18 AM, Peter Zsoldos [email protected] wrote:
Also added regression tests for the things that had to be fixed during the
upgrade
You can view, comment on, or merge this pull request online at:
https://github.com/machinalis/django-template-previewer/pull/14 Commit Summary
- basic gitignore
- django 1.7 merged BaseIncludeNode, ConstantIncludeNode and Include node.
- asof 1.5, url args need to be explicit strings or will be interpreted as variables
- adjust for some 1.4 -> 1.8 changes
- basic test infrastructure seetup
- make sure we have staticfiles, as we need them for this app
- add names to all urls so we can easily test them
- make sure we can load the main page
- s/mimetype/content_type/g
- make sure we can parse the sample template example
- extrac parse_template helper method
- url tag behavior changed in django 1.5
- simplify template for an upcoming test about posting to preview
- basic happy path can render preview for a template test
- make sure variables from blocktrans blocks are recognized
- support trans templatetag too
- shortcut comment when debugging a single test
- add todo that we currently don't need
- translating literal strings shouldn't be picked up as strings
- basic attempt to recognize context usage by custom templatetags
- support deep property usage for context variables in template tags
- basic refactoring implementation for render_preview
- allow ContextItem properties to be accessed both as a dict and as properties
- make sure we can render custom template tags too
- conditionals pt1 - don't treat constants as context variables
- make sure we can render conditionals in the template correctly
- regression test to make sure variables inside comments are ignored
- regression test so for loops work
- regression test for includes parsing
- make sure that the pythonic unary if works in templates
- reproduce bug that sometimes loop variables are displayed twice - once as loop, and once as individual var
- bugfix: when nesting tags, don't process the same node multiple times
- add Django 1.9 support
- remove deprecated (removed 1.10) django.conf.urls.patterns
- in django 1.10, template.render takes a dict, not a context
- django 1.10 compatible template settings
- remove unneeded django version definitions
- add django 1.10 support
- fix template syntax & add regression test
- fix include behavior as test wasn't actually asserting
- extract helper class from testcases
- add regression test to ensure tuple loop variables are parsed
- starting with python 3 support: response.content needs to be decoded in py3x
- parse JSON in a py2/py3 compatible way from a string
- in py3, nonzero became bool
- extract
get_stripped_response_content
helper method and make it py3 compatible- make ContextItem.str be both py2/3 compatible by using django's force_text
- py3 doesn't have long, so let's use six.integer_types
- py3 compatibility: replace unicode with django's force_text
- py3 compatibility: use six.iteritems instead of dict.iteritems
- py3 compatibility: don't rely on type's repr, but construct full name from module and class name
- remove boilerplate: there are no docs to generate
- as now all tests are passing on python3, run tox against those environmnets too
- remove boilerplate: tagging & versioning here works different
File Changes
- A .gitignore https://github.com/machinalis/django-template-previewer/pull/14/files#diff-0 (42)
- A Makefile https://github.com/machinalis/django-template-previewer/pull/14/files#diff-1 (63)
- A manage.py https://github.com/machinalis/django-template-previewer/pull/14/files#diff-2 (10)
- A settings.py https://github.com/machinalis/django-template-previewer/pull/14/files#diff-3 (38)
- M template_previewer/template_parser/context.py https://github.com/machinalis/django-template-previewer/pull/14/files#diff-4 (90)
- M template_previewer/templates/template_previewer/preview.html https://github.com/machinalis/django-template-previewer/pull/14/files#diff-5 (2)
- M template_previewer/urls.py https://github.com/machinalis/django-template-previewer/pull/14/files#diff-6 (13)
- M template_previewer/views.py https://github.com/machinalis/django-template-previewer/pull/14/files#diff-7 (47)
- A tests/setup.py https://github.com/machinalis/django-template-previewer/pull/14/files#diff-8 (44)
- A tests/testapp/init.py https://github.com/machinalis/django-template-previewer/pull/14/files#diff-9 (0)
- A tests/testapp/models.py https://github.com/machinalis/django-template-previewer/pull/14/files#diff-10 (0)
- A tests/testapp/templates/comments.html https://github.com/machinalis/django-template-previewer/pull/14/files#diff-11 (5)
- A tests/testapp/templates/conditionals.html https://github.com/machinalis/django-template-previewer/pull/14/files#diff-12 (5)
- A tests/testapp/templates/hidden_context_use_via_template_tags.html https://github.com/machinalis/django-template-previewer/pull/14/files#diff-13 (3)
- A tests/testapp/templates/if-unary-condition.html https://github.com/machinalis/django-template-previewer/pull/14/files#diff-14 (1)
- A tests/testapp/templates/include-single.html https://github.com/machinalis/django-template-previewer/pull/14/files#diff-15 (1)
- A tests/testapp/templates/includes-main.html https://github.com/machinalis/django-template-previewer/pull/14/files#diff-16 (3)
- A tests/testapp/templates/includes-repeat.html https://github.com/machinalis/django-template-previewer/pull/14/files#diff-17 (1)
- A tests/testapp/templates/loop-inside-block.html https://github.com/machinalis/django-template-previewer/pull/14/files#diff-18 (5)
- A tests/testapp/templates/loops.html https://github.com/machinalis/django-template-previewer/pull/14/files#diff-19 (3)
- A tests/testapp/templates/sample.html https://github.com/machinalis/django-template-previewer/pull/14/files#diff-20 (6)
- A tests/testapp/templates/translation.html https://github.com/machinalis/django-template-previewer/pull/14/files#diff-21 (4)
- A tests/testapp/templates/tuples-in-loops.html https://github.com/machinalis/django-template-previewer/pull/14/files#diff-22 (3)
- A tests/testapp/templates/url.html https://github.com/machinalis/django-template-previewer/pull/14/files#diff-23 (1)
- A tests/testapp/templatetags/init.py https://github.com/machinalis/django-template-previewer/pull/14/files#diff-24 (0)
- A tests/testapp/templatetags/custom_tags_with_context.py https://github.com/machinalis/django-template-previewer/pull/14/files#diff-25 (11)
- A tests/testapp/tests.py https://github.com/machinalis/django-template-previewer/pull/14/files#diff-26 (237)
- A tests/testapp/urls.py https://github.com/machinalis/django-template-previewer/pull/14/files#diff-27 (6)
- A tox.ini https://github.com/machinalis/django-template-previewer/pull/14/files#diff-28 (21)
Patch Links:
- https://github.com/machinalis/django-template-previewer/pull/14.patch
- https://github.com/machinalis/django-template-previewer/pull/14.diff
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/machinalis/django-template-previewer/pull/14, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMQHWWpLP7u32dGMMt9OZ9l0pSQPSH-ks5qirrtgaJpZM4Jqtu6 .
Daniel F. Moisset - UK Country Manager www.machinalis.com Skype: @dmoisset
You are welcome, we have found this tool pretty handy and I was happy to upgrade it :) Should have made this PR months ago, but better later than never.
I've left in the exact small step commits as I know some people prefer that to having a giant diff (and it can help with incremental review). Thanks in advance for taking the time to review it!
@dmoisset ping - have you had the chance to look through it?
Nope sorry, I've been a bit overwhelmed with work and events, I apologize for the long time this is taking
On Wed, Sep 14, 2016 at 12:55 PM, Peter Zsoldos [email protected] wrote:
@dmoisset https://github.com/dmoisset ping - have you had the chance to look through it?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/machinalis/django-template-previewer/pull/14#issuecomment-246989768, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMQHQBb_WFl18HeI8sCJEiwcWWxMUt0ks5qp-DOgaJpZM4Jqtu6 .
Daniel F. Moisset - UK Country Manager www.machinalis.com Skype: @dmoisset