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

813[Cheetahtemplate-discuss] Namemapper bug for key starting with 'times'

Expand Messages
  • Hamish Lawson
    Mar 6, 2002
    • 0 Attachment
      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-discuss
    • Show all 4 messages in this topic