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

[Cheetahtemplate-discuss] Re: Re: 2.0rc6 works on some Pythons but not all ("NameMapper.NotFound: cannot find

Expand Messages
  • Stephane Bortzmeyer
    On Wed, Mar 15, 2006 at 02:24:18PM -0800, Tavis Rudd wrote ... I do not remember where I did find it. ... It works now with 2.0rc6 and
    Message 1 of 13 , Mar 16, 2006
    • 0 Attachment
      On Wed, Mar 15, 2006 at 02:24:18PM -0800,
      Tavis Rudd <tavis@...> wrote
      a message of 33 lines which said:

      > as an aside, I noticed you're assigning to the search list directly:
      ...
      > You shouldn't do that.

      I do not remember where I did find it.

      > Instead it should be something like this:

      It works now with 2.0rc6 and all the Pythons installation I can
      find. But it no longer works with 1.0 and I need compatibility:

      Traceback (most recent call last):
      File "load.py", line 95, in ?
      formClass = Template.compile(file="formulaire.tmpl")
      TypeError: unbound method compile() must be called with Template instance as first argument (got nothing instead)


      -------------------------------------------------------
      This SF.Net email is sponsored by xPML, a groundbreaking scripting language
      that extends applications into web and mobile media. Attend the live webcast
      and join the prime developer group breaking into this new coding territory!
      http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
      _______________________________________________
      Cheetahtemplate-discuss mailing list
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    • Stephane Bortzmeyer
      On Wed, Mar 15, 2006 at 02:24:11PM -0800, Tavis Rudd wrote ... No, it works fine with 1.0. As a workaround, I went back to 1.0. ... It
      Message 2 of 13 , Mar 16, 2006
      • 0 Attachment
        On Wed, Mar 15, 2006 at 02:24:11PM -0800,
        Tavis Rudd <tavis@...> wrote
        a message of 56 lines which said:

        > thanks for the bug report. Does this problem also occur with Cheetah
        > 1.0

        No, it works fine with 1.0. As a workaround, I went back to 1.0.

        > Also, does the 2.3.4 installation on RHEL do any non-standard magic
        > with 'pysco' (http://psyco.sourceforge.net/)?

        It does not seem there is Psyco at all on the installation.



        -------------------------------------------------------
        This SF.Net email is sponsored by xPML, a groundbreaking scripting language
        that extends applications into web and mobile media. Attend the live webcast
        and join the prime developer group breaking into this new coding territory!
        http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
        _______________________________________________
        Cheetahtemplate-discuss mailing list
        Cheetahtemplate-discuss@...
        https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
      • Stephane Bortzmeyer
        On Thu, Mar 16, 2006 at 09:11:49AM +0100, Stephane Bortzmeyer wrote ... The following code seems to work with both versions. It is highly
        Message 3 of 13 , Mar 16, 2006
        • 0 Attachment
          On Thu, Mar 16, 2006 at 09:11:49AM +0100,
          Stephane Bortzmeyer <bortzmeyer@...> wrote
          a message of 30 lines which said:

          > It works now with 2.0rc6 and all the Pythons installation I can
          > find. But it no longer works with 1.0 and I need compatibility:

          The following code seems to work with both versions. It is highly
          inelegant and I welcome better ideas:

          import Cheetah
          from Cheetah.Template import Template
          import re

          values = {'foo': 1, 'bar': 2}

          def version2num(str):
          (major, minor, garbage) = re.split('[\.a-zA-Z]+', str)
          return float(major) + float(minor)/10

          print Cheetah.Version
          version = version2num(Cheetah.Version)
          print version
          if version < 2.0:
          form = Template(file="test.tmpl")
          form._searchList=[values]
          else:
          formClass = Template.compile(file="test.tmpl")
          form = formClass(searchList=[values])

          msg = "Result: "
          msg = msg + str(form)
          print msg


          -------------------------------------------------------
          This SF.Net email is sponsored by xPML, a groundbreaking scripting language
          that extends applications into web and mobile media. Attend the live webcast
          and join the prime developer group breaking into this new coding territory!
          http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
          _______________________________________________
          Cheetahtemplate-discuss mailing list
          Cheetahtemplate-discuss@...
          https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
        • Tavis Rudd
          with 1.0: form = Template(file= test.tmpl , searchList=[values]) then change the values as needed or you could compile the template into a python class using
          Message 4 of 13 , Mar 16, 2006
          • 0 Attachment
            with 1.0:
            form = Template(file="test.tmpl", searchList=[values])
            then change the values as needed

            or you could compile the template into a python class using the command-line
            tool, then import it and continue as you do with 2.0

            On Thursday 16 March 2006 12:27 am, Stephane Bortzmeyer wrote:
            > On Thu, Mar 16, 2006 at 09:11:49AM +0100,
            > Stephane Bortzmeyer <bortzmeyer@...> wrote
            >
            > a message of 30 lines which said:
            > > It works now with 2.0rc6 and all the Pythons installation I can
            > > find. But it no longer works with 1.0 and I need compatibility:
            >
            > The following code seems to work with both versions. It is highly
            > inelegant and I welcome better ideas:
            >
            > import Cheetah
            > from Cheetah.Template import Template
            > import re
            >
            > values = {'foo': 1, 'bar': 2}
            >
            > def version2num(str):
            > (major, minor, garbage) = re.split('[\.a-zA-Z]+', str)
            > return float(major) + float(minor)/10
            >
            > print Cheetah.Version
            > version = version2num(Cheetah.Version)
            > print version
            > if version < 2.0:
            > form = Template(file="test.tmpl")
            > form._searchList=[values]
            > else:
            > formClass = Template.compile(file="test.tmpl")
            > form = formClass(searchList=[values])
            >
            > msg = "Result: "
            > msg = msg + str(form)
            > print msg


            -------------------------------------------------------
            This SF.Net email is sponsored by xPML, a groundbreaking scripting language
            that extends applications into web and mobile media. Attend the live webcast
            and join the prime developer group breaking into this new coding territory!
            http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
            _______________________________________________
            Cheetahtemplate-discuss mailing list
            Cheetahtemplate-discuss@...
            https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
          • Stephane Bortzmeyer
            On Thu, Mar 16, 2006 at 12:32:58AM -0800, Tavis Rudd wrote ... So, there is no proper and version-independant solution? Changing all my
            Message 5 of 13 , Mar 16, 2006
            • 0 Attachment
              On Thu, Mar 16, 2006 at 12:32:58AM -0800,
              Tavis Rudd <tavis@...> wrote
              a message of 41 lines which said:

              > with 1.0:
              > form = Template(file="test.tmpl", searchList=[values])

              So, there is no proper and version-independant solution? Changing all
              my programs which use Cheetah will be difficult, I would as well
              prefer to do it for the last time.



              -------------------------------------------------------
              This SF.Net email is sponsored by xPML, a groundbreaking scripting language
              that extends applications into web and mobile media. Attend the live webcast
              and join the prime developer group breaking into this new coding territory!
              http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
              _______________________________________________
              Cheetahtemplate-discuss mailing list
              Cheetahtemplate-discuss@...
              https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
            • Tavis Rudd
              This idiom also works with 2.0. ... This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile
              Message 6 of 13 , Mar 16, 2006
              • 0 Attachment
                This idiom also works with 2.0.

                On Thursday 16 March 2006 12:40 am, Stephane Bortzmeyer wrote:
                > On Thu, Mar 16, 2006 at 12:32:58AM -0800,
                > Tavis Rudd <tavis@...> wrote
                >
                > a message of 41 lines which said:
                > > with 1.0:
                > > form = Template(file="test.tmpl", searchList=[values])
                >
                > So, there is no proper and version-independant solution? Changing all
                > my programs which use Cheetah will be difficult, I would as well
                > prefer to do it for the last time.


                -------------------------------------------------------
                This SF.Net email is sponsored by xPML, a groundbreaking scripting language
                that extends applications into web and mobile media. Attend the live webcast
                and join the prime developer group breaking into this new coding territory!
                http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
                _______________________________________________
                Cheetahtemplate-discuss mailing list
                Cheetahtemplate-discuss@...
                https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
              • Stephane Bortzmeyer
                On Thu, Mar 16, 2006 at 12:46:23AM -0800, Tavis Rudd wrote ... Yes, many thanks, tested and approved. One last question: instantiating
                Message 7 of 13 , Mar 16, 2006
                • 0 Attachment
                  On Thu, Mar 16, 2006 at 12:46:23AM -0800,
                  Tavis Rudd <tavis@...> wrote
                  a message of 13 lines which said:

                  > This idiom also works with 2.0.

                  Yes, many thanks, tested and approved.

                  One last question: instantiating the template with values occur in a
                  loop which must be fast. Is there anyway to move some processing
                  (compiling the template, for instance) outside of the loop.



                  -------------------------------------------------------
                  This SF.Net email is sponsored by xPML, a groundbreaking scripting language
                  that extends applications into web and mobile media. Attend the live webcast
                  and join the prime developer group breaking into this new coding territory!
                  http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
                  _______________________________________________
                  Cheetahtemplate-discuss mailing list
                  Cheetahtemplate-discuss@...
                  https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
                • Shannon -jj Behrens
                  ... If you care about speed, pre-compile your templates in production and all your problems will go away :) -jj ... This SF.Net email is sponsored by xPML, a
                  Message 8 of 13 , Mar 16, 2006
                  • 0 Attachment
                    On 3/16/06, Stephane Bortzmeyer <bortzmeyer@...> wrote:
                    > On Thu, Mar 16, 2006 at 12:46:23AM -0800,
                    > Tavis Rudd <tavis@...> wrote
                    > a message of 13 lines which said:
                    >
                    > > This idiom also works with 2.0.
                    >
                    > Yes, many thanks, tested and approved.
                    >
                    > One last question: instantiating the template with values occur in a
                    > loop which must be fast. Is there anyway to move some processing
                    > (compiling the template, for instance) outside of the loop.

                    If you care about speed, pre-compile your templates in production and
                    all your problems will go away :)

                    -jj


                    -------------------------------------------------------
                    This SF.Net email is sponsored by xPML, a groundbreaking scripting language
                    that extends applications into web and mobile media. Attend the live webcast
                    and join the prime developer group breaking into this new coding territory!
                    http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
                    _______________________________________________
                    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.