How to remove or silence 'attribute not allowed here' errors in Pycharm?

  • 2
  • 14

Using Windows Pycharm 2.7.

I'm trying to get rid of the annoying pycharm warnings. I attached a picture of a snippet of my code in pycharm. For example, when I highlight 'tal:define' I get a "attribute tal:define is not allowed here" (as well as all the other 'red' outlined errors). The 'light bulb' only gives me only a'remove attribute' option.

My friend is using the mac version of pycharm 2.7. He is able to disable the warnings somehow. The 'light bulb' next to the error gives him other options than I have on the PC version of pycharm. Is there something I'm doing wrong? Suggestions?

The code works perfectly. I'm just trying to get rid of the pycharm errors.

Capture.JPG
Hi fatfantasma,

do you use PyCharm 3.0 EAP with Chameleon template language chosen in Settings->Template languages?

It's known issue and it'll be fixed in new EAP. For now you can disable inspections in Settings->Inspections->HTML->Unknown HTML tag attribute/Unknown HTML tag.
It could be done using Alt+Enter on erroneous code, then hit right and choose "Edit inspection profile setting".

Hi Ekaterina,

I have made some progress based on your information. I switched over to Pycharm 3.0 EAP and selected Chameleon as my template language. This resolved most of the errors.

There were still unknown tags and unknown tag attributes to deal with. Instead of disabling unknown tag/unknown tag attributes I was able to add 'tal' as a custom attribute in the Unknown tag section and 'metal:use-macro' in the Unknown tag attribute. For some reason, attributes such as 'metal:fill-slot', 'tal:define' never raised an error so I didn't have to do anything with them.

Another side effect was that my html namespace declaration is not fully being detected now.

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
lang="en">


xmlns:tal="http://xml.zope.org/namespaces/tal" gives 'Namespace Declaration is never used".

I hope this helps and if you have any other suggestions please let me know. I look forward to the fixes.