Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tokenizing {{}} results in an IndexError #102

Open
jeking3 opened this issue Aug 4, 2021 · 0 comments
Open

Tokenizing {{}} results in an IndexError #102

jeking3 opened this issue Aug 4, 2021 · 0 comments

Comments

@jeking3
Copy link

jeking3 commented Aug 4, 2021

The tag parser is looking for content on an empty string.

>>> from chevron.tokenizer import tokenize
>>> print(list(tokenize(r"{{ foo }}")))
[('variable', 'foo')]
>>> print(list(tokenize(r"{{foo}}")))
[('variable', 'foo')]
>>> print(list(tokenize(r"{{ }}")))
[('variable', '')]
>>> print(list(tokenize(r"{{}}")))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/.../.tox/run/lib/python3.9/site-packages/chevron/tokenizer.py", line 190, in tokenize
    tag, template = parse_tag(template, l_del, r_del)
  File "/home/.../.tox/run/lib/python3.9/site-packages/chevron/tokenizer.py", line 89, in parse_tag
    tag_type = tag_types.get(tag[0], 'variable')
IndexError: string index out of range
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant