wbond / pybars3

Handlebars.js template support for Python 3 and 2
GNU Lesser General Public License v3.0
179 stars 46 forks source link

OMeta parse errors get ignored by pybars3 #23

Closed isaacdd closed 8 years ago

isaacdd commented 8 years ago

To reproduce:

>> from pybars import Compiler
>> compiler = Compiler()
>> text = "{{#test}}a{{/#test}}"
>> compiler.compile(unicode(text))
<function render at 0x275f2a8>  # no error reported here

After inspecting the parse error, it seems that OMeta only reports the position, but None for the error.

>> tree, error = compiler._handlebars(text).apply('template')
>>> error
ParseError(13, None)

I think a parse error should be raised whenever the parse position is less than the length of the string.

dagnelies commented 8 years ago

+1

isaacdd commented 8 years ago

@dagnelies This has been fixed in this fork: https://github.com/DataDog/pybars3 with this PR (https://github.com/DataDog/pybars3/pull/1).

wbond commented 8 years ago

@isaacdd Are you interested in having access to this repo and the project on PyPi? I'm too overcommitted with stuff right now to keep up with this.

isaacdd commented 8 years ago

@wbond Thanks! I would be interested in that.

wbond commented 8 years ago

@isaacdd Do you have a PyPi username?

isaacdd commented 8 years ago

@wbond it is isadaqah.

wbond commented 8 years ago

Ok, all set on GitHub and PyPi. Thanks for helping out!

tomgross commented 8 years ago

If you do a release can you include the other PR #19 #20 and #21 too, please?

isaacdd commented 8 years ago

Fixed with 0.9.2.

dagnelies commented 8 years ago

great, thanks @isaacdd !