Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Komodo Edit 5.2 Django Template Syntax Error - Info: <head> previously mentioned

I am using Komodo Edit 5.2 for editing html and Django template files. It always shows a single syntax error inside the first {% block %} area on the first tag of my template.

For example:

{% extends "base.html" %}
{% load i18n %}

{% block title %}Hello{% endblock %}

{% block content %}
    <p>Hello</p> <-- Syntax error on this single line
    <p>Other lines have no errors</p>
{% endblock %}

{% block footer %}
    <p>No errors here</p>
{% endblock %}

The syntax error given is:

Info: <head> previously mentioned

I know for a fact that the error has nothing to do with my <head> tag since it occurs in the base template and in child templates (and the IDE isn't smart enough to process the base templates when in a child, etc.) All of my html tags are closed properly and everything validates for XHTML strict.

This forum post mentions a similar problem but offers no solution (and may be specific to Smarty syntax highlighting).

Any ideas on how to resolve this error (or disable it from being shown)?

like image 601
Lance McNearney Avatar asked Jan 10 '10 16:01

Lance McNearney


1 Answers

Yes, this can be fixed, but it's really rather ugly a method.

I should point out this is a bug that's in the tracker #77251 (edit: this is fixed in Komodo 6.1.0). You could watch that bug to find when it actually gets fixed.

As for stopping the red squiggly lines -- You can do this by editing the python language file for Django template HTML manually. The file you want to edit is koDjango_URL_Language.py, and can be found in ..ActiveState Komodo Edit 5\lib\mozilla\extensions\[email protected]\components.

Add the following override method to class KoDjangoLanguage:

def get_linter(self):
    return None

Note that this assumes you are saving your django template files as .django.html (which on a side note if you have not, doing so provides template-tag syntax coloring, which is kinda nice). After editing the file, save, and reload Komodo and the problem should go away.

From what I understand this file needs to be re-edited whenever you upgrade versions of Komodo as well. Hopefully we'll see sooner than later this whole issue get fixed and better all around support for Django in everyone's favorite IDE's.

like image 92
T. Stone Avatar answered Oct 01 '22 07:10

T. Stone