Skip to content

KeyError: 'elif' in ext/html #291

@wolfgang42

Description

@wolfgang42
Traceback (most recent call last):
  [...]
  File "venv/lib/python3.8/site-packages/pyjade/compiler.py", line 129, in visitNode
    return getattr(self, 'visit%s' % name)(node, *args, **kwargs)
  File "venv/lib/python3.8/site-packages/pyjade/ext/html.py", line 108, in visitConditional
    self.visitConditional(item)
  File "venv/lib/python3.8/site-packages/pyjade/ext/html.py", line 104, in visitConditional
    if TYPE_CODE[conditional.type](value):
KeyError: 'elif'

Looks like the same sort of problem as #13.

Workaround:

# Bugfix for python-jade: pyjade/ext/html.py:TYPE_CODE has a typo and incorrectly declares 'elsif' instead of 'elif'
# https://github.com/syrusakbary/pyjade/issues/291
import pyjade, operator
pyjade.ext.html.TYPE_CODE['elif'] = operator.truth

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions