I'm sure I'm speaking out of turn here, but what good is it to rely on the composition of generated source code? It would be a true shame if Chameleon internals became APIs.
On 3/1/10 10:47 AM, Uli Fouquet wrote: > Hi there, > > Malthe Borch wrote: >> On 27 February 2010 12:10, Uli Fouquet<u...@gnufix.de> wrote: >>> While trying to make megrok.chameleon compatible with zopetoolkit and >>> groktoolkit package versions, I noticed that latest z3c.pt (1.1.0) and >>> trunk are not completely compatible with Chameleon>= 1.1.0. The tests >>> fail. >> >> Do you think you can find time to try and reproduce this in straight >> Chameleon? > > Sure, the following doctest example added to core/codegen.txt passes > with Chameleon 1.0.8:: > > Syntax extension: ``econtext`` references > ----------------------------------------- > > >>> suite = Suite("""\ > ... result = _path(options, True, 'test') > ... """) > >>> suite.source > "result = econtext['_path'](econtext['options'], True, 'test')\n" > > But with Chameleon trunk gives:: > > ---------------------------------------------------------------------- > File "...chameleon/trunk/src/chameleon/core/codegen.txt", line 48, in > codegen.txt > Failed example: > suite.source > Expected: > "result = econtext['_path'](econtext['options'], True, 'test')\n" > Got: > "result = > econtext['econtext']['_path'](econtext['econtext']['options'], True, > 'test')\n" > > [snip] > >>> 'options/test' >>> result = econtext['econtext']['_path']( >>> econtext['econtext']['options'], >>> econtext['econtext']['request'], True, 'test') >> >> Seems like the code that does the name transformation >> (codegen.py:visit_Name) should include ``econtext`` to the list of >> globally known symbols. > > Ah, I see. Thanks for the hint! Looks like this is really the crucial > point. > > When I add ``'econtext'`` to ``CONSTANTS`` (just to inject it somewhere, > probably not the right place), all tests pass, including the snippet > above. This is true for both versions, the current trunk and 1.0.8 :-) > > [snip] > > Thanks for looking into this! If you think the mentioned behaviour is > really a bug in Chameleon, I'd be glad to assist in fixing it. > > Best regards, > > > > > _______________________________________________ > Repoze-dev mailing list > Repoze-dev@lists.repoze.org > http://lists.repoze.org/listinfo/repoze-dev -- Chris McDonough Agendaless Consulting, Fredericksburg VA The repoze.bfg Web Application Framework Book: http://bfg.repoze.org/book _______________________________________________ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev