Any tool to validate django templates?

456 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Marcin Tustin

ungelesen,
15.04.2012, 12:42:1415.04.12
an django...@googlegroups.com
Hi all,

I've got a template that isn't parsing, but the error is the nondescript: TemplateSyntaxError: Could not parse the remainder: '"{%' from '"{%'

Is there a tool that can help locate the source of the error?

Marcin

--
Marcin Tustin
Tel: 07773 787 105

Matt Schinckel

ungelesen,
16.04.2012, 03:15:3916.04.12
an django...@googlegroups.com
Generally, I just use syntax highlighting in my text editor: that usually helps me find errors.

TextMate has a nice HTML (Django Template) mode.

Matt.

william ratcliff

ungelesen,
16.04.2012, 08:45:1716.04.12
an django...@googlegroups.com

Wing IDE also highlights templates.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/IOteWda5w0UJ.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

John Yeukhon Wong

ungelesen,
16.04.2012, 11:12:3716.04.12
an django...@googlegroups.com
Would this help?
http://stackoverflow.com/questions/3086637/how-should-i-validate-html-in-django-templates-during-the-development-process

I quite like the not-accepted-as-answer. Just go through your urls. Essentially, you have two types of possible template errors:

1. human errors (missing a close tag / mispell)
2. logic error

For logic error, you are dealing with mostly logic tags  such as url tags or custom tags rendering problem. For example, does your {% url my_view id username %} actually works? are the variables passing to / from view are good for these tags? THis kind of error is not possible checked with going through all urls because u can't test possibility like that. THat has to be handled by unit test and integration (system) test.


Good luck.

Mario Gudelj

ungelesen,
16.04.2012, 11:15:0116.04.12
an django...@googlegroups.com
PyCharm does a very good job here when it comes to highlighting and error detection in templates. Try it out.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Ml-zdg0y4WEJ.

Marcin Tustin

ungelesen,
16.04.2012, 11:17:5116.04.12
an django...@googlegroups.com
Thanks. Neither of those would help with my problem, which is that django itself was refusing to parse my template.

My solution was to simply comment out regions, and re-instate them until the error was once again detected.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Ml-zdg0y4WEJ.

To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten