Problems with multiple macros in the same paragraph

9 views
Skip to first unread message

Bryan

unread,
Jun 15, 2010, 5:20:32 PM6/15/10
to creoleparser
Hi,

I am getting an assertion error when I have two macros in the same
paragraph, i.e.

This is <<first>>my<</first>> example that <<second>>causes the error
<</second>>.

This causes AssertionError at Creoleparser-0.7.2-py2.6.egg/
creoleparser/elements.py in _process, line 500

Multiple instances of the same macro work like a charm.

Tracking it down here is the relevant snippet of the code:

def _process(self, mos, text, wiki_elements,element_store,
environ):
"""Returns genshi Fragments (Elements and text)"""
assert len(mos) == 1

The value for "mos" is [<_sre.SRE_Match object at 0x396a768>,
<_sre.SRE_Match object at 0x396a810>] which clearly causes the
problem.

The interesting thing is if I simply comment out the assert,
everything works perfect. Both macros are called correctly. I don't
want to run a modified version of creoleparser so I am hoping there is
a better way to do this, perhaps just assert that the length is
greater than 0?

Best Regards,
/bryan

Stephen Day

unread,
Jun 15, 2010, 7:08:16 PM6/15/10
to creoleparser
Hi Bryan,

It looks like a bug, though I tried quickly to reproduce and wasn't
able. I'm not running Python 2.6 so that may be the answer... will try
later.

len(mos) > 0 probably isn't a good solution.

Is there anything special about the macros? If Python 2.6 is not the
answer, I may need a better code example to reproduce. If you think of
anything in the mean-time, please create an issue for this and we will
track it there:

http://code.google.com/p/creoleparser/issues/entry

Thanks for the report.

Stephen

Bryan Alsdorf

unread,
Jun 16, 2010, 4:24:36 AM6/16/10
to creole...@googlegroups.com
Hi Stephen,

Thanks for your reply. As I feared before I sent the email this was
actually due to a bug in my code, I had made a mistake in my Dialect
class. I found it while create a test case to submit.

Sorry for the false report, I am still fairly new to python and make
simple mistakes. Next time I will come up with a simple test case
before I send an email.

Best Regards,
/bryan

> --
> You received this message because you are subscribed to the Google Groups "creoleparser" group.
> To post to this group, send email to creole...@googlegroups.com.
> To unsubscribe from this group, send email to creoleparser...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/creoleparser?hl=en.
>
>

Stephen Day

unread,
Jun 16, 2010, 7:16:33 AM6/16/10
to creoleparser
> Sorry for the false report,

No problem. Glad you were able to figure it out.

Stephen
Reply all
Reply to author
Forward
0 new messages