Can Unbound XML namespace prefix inspection understand Django template extension?

I have a base Django template, say base.html that defines my html document:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:og="http://ogp.me/ns#"
    xmlns:fb="http://www.facebook.com/2008/fbml">

....

Now, if I have another template that extends this template and uses one of the additional namespaces, the "Unbound XML namespace prefix" inspection will flag the use.  I assume this is because it is only looking in the current file.

{% extends "base.html" %}
<fb:comments href="some_url" num_posts="2" width="500"></fb:comments>

Here "fb" will be marked in red since the namespace is not found.

Is there a way to make this inspection work?

0
1 comment

Hello Chris,

We have a bug report for this already:

http://youtrack.jetbrains.net/issue/PY-1257

This is something that can be handled by PyCharm, but at the moment is not.

You should be able to simply turn off the inspection if it doesn't work as

expected for your project.

I have a base Django template, say base.html that defines my html

document:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html

xmlns="http://www.w3.org/1999/xhtml"

xmlns:og="http://ogp.me/ns#"

xmlns:fb="http://www.facebook.com/2008/fbml">

...

Now, if I have another template that extends this template and uses

one of the additional namespaces, the "Unbound XML namespace prefix"

inspection will flag the use.  I assume this is because it is only

looking in the current file.

{% extends "base.html" %}

<fb:comments href="some_url" num_posts="2" width="500"></fb:comments>

Here "fb" will be marked in red since the namespace is not found.

Is there a way to make this inspection work?

--

Dmitry Jemerov

Development Lead

JetBrains, Inc.

http://www.jetbrains.com/

"Develop with Pleasure!"

0

Please sign in to leave a comment.