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

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

Expand Messages
  • Hamish Lawson
    I think I ve found a bug in Namemapper as demonstrated in the test program below. ... from Cheetah.Template import Template template_source = #for
    Message 1 of 4 , Mar 6 4:43 AM
    • 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
    • Tavis Rudd
      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
      Message 2 of 4 , Mar 6 10:11 AM
      • 0 Attachment
        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-discus
        >s

        _______________________________________________
        Cheetahtemplate-discuss mailing list
        Cheetahtemplate-discuss@...
        https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
      • Tavis Rudd
        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 ;) ...
        Message 3 of 4 , Mar 6 10:17 AM
        • 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
        • Tavis Rudd
          Hi, I ve just released version 0.9.10. It s a stable bugfix release based on the current cvs version. http://cheetahtemplate.org/download.html Tavis
          Message 4 of 4 , Mar 6 10:59 AM
          • 0 Attachment
            Hi, I've just released version 0.9.10. It's a stable bugfix release
            based on the current cvs version.
            http://cheetahtemplate.org/download.html
            Tavis

            _______________________________________________
            Cheetahtemplate-discuss mailing list
            Cheetahtemplate-discuss@...
            https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
          Your message has been successfully submitted and would be delivered to recipients shortly.