Loading ...
Sorry, an error occurred while loading the content.

815Re: [Cheetahtemplate-discuss] Namemapper bug for key starting with 'times'

Expand Messages
  • Tavis Rudd
    Mar 6, 2002
    • 0 Attachment
      hmmm, not only did removing that old code fix the bug, it shaved
      approx. 10% off the time it takes to run the test suite. Thanks for
      finding it ;)

      On Wednesday 06 March 2002 10:11, Tavis Rudd wrote:
      > Hamish,
      > please remember to state what version of Cheetah and Python you're
      > working with and what OS you're on when you sumbit a bug report.
      > There was some residual code in Compiler.py from a previous
      > incarnation of Cheetah causing this. I've removed it in the CVS
      > version now.
      > Tavis
      >
      > On Wednesday 06 March 2002 04:43, Hamish Lawson wrote:
      > > I think I've found a bug in Namemapper as demonstrated in the
      > > test program below.
      > >
      > > ----
      > > from Cheetah.Template import Template
      > >
      > > template_source = """\
      > > #for $timesheet in $timesheets
      > > ${timesheet.week}
      > > #end for
      > > """
      > >
      > > timesheets = [
      > > {'week': 46},
      > > {'week': 47},
      > > {'week': 48},
      > > {'week': 49},
      > > ]
      > >
      > > t = Template(source=template_source, searchList=[{'timesheets':
      > > timesheets}])
      > > print t.respond()
      > > ----
      > >
      > > This gives rise to the following error about not finding 'heets'.
      > > It looks like it does not like the fact that the 'timesheets' key
      > > starts with 'times'.
      > >
      > > ----
      > > Traceback (most recent call last):
      > > File "E:\temp\test_cheetah\script.py", line 17, in ?
      > > print t.respond()
      > > File "<string>", line 25, in respond
      > > File "E:\Python22\Lib\site-packages\Cheetah\NameMapper.py",
      > > line 217, in valueForName
      > > return _valueForName(obj, nameChunks,
      > > executeCallables=executeCallables) File
      > > "E:\Python22\Lib\site-packages\Cheetah\NameMapper.py", line 228,
      > > in _valueForName
      > > binding = valueForKey(obj, firstKey)
      > > File "E:\Python22\Lib\site-packages\Cheetah\NameMapper.py",
      > > line 203, in valueForKey
      > > raise NotFound, key
      > > Cheetah.NameMapper.NotFound: heets
      > > ----
      > >
      > >
      > > Hamish Lawson
      > >
      > >
      > >
      > > _______________________________________________
      > > Cheetahtemplate-discuss mailing list
      > > Cheetahtemplate-discuss@...
      > > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-disc
      > >us s
      >
      > _______________________________________________
      > Cheetahtemplate-discuss mailing list
      > Cheetahtemplate-discuss@...
      > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discus
      >s

      _______________________________________________
      Cheetahtemplate-discuss mailing list
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    • Show all 4 messages in this topic