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

[Cheetahtemplate-discuss] scoping

Expand Messages
  • Paul Sorenson
    I have a vanilla cgi template in which I want to access the cgi parameters and I am stumbling on scoping. At the top of the template (after importing cgi) I
    Message 1 of 7 , Aug 6, 2002
    • 0 Attachment
      I have a vanilla cgi template in which I want to access the cgi parameters
      and I am stumbling on scoping.

      At the top of the template (after importing cgi) I have:
      #set global $form = $cgi.FieldStorage()

      and then in the body of my template I have
      $form.getFirst("foobar")

      At run time I get NameMapper.NotFound: form

      Now even if there is something that is predefined to help me with CGI
      headers (I haven't been able to make the docs from the tex source yet - but
      feel free to set me straight) I would still like to understand the scope of
      "#set" and "#set global"

      sosman



      -------------------------------------------------------
      This sf.net email is sponsored by:ThinkGeek
      Welcome to geek heaven.
      http://thinkgeek.com/sf
      _______________________________________________
      Cheetahtemplate-discuss mailing list
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    • Huy Do
      Hi All, Is there a recommended way of internationalizing templates. The easiest way I ve come up with is to set internationlized strings using #set then Using
      Message 2 of 7 , Aug 6, 2002
      • 0 Attachment
        Hi All,

        Is there a recommended way of internationalizing templates.

        The easiest way I've come up with is to set internationlized strings
        using #set then
        Using the $string.

        Eg. #set $aString = _("This will be translated")

        Thanks

        Huy



        -------------------------------------------------------
        This sf.net email is sponsored by:ThinkGeek
        Welcome to geek heaven.
        http://thinkgeek.com/sf
        _______________________________________________
        Cheetahtemplate-discuss mailing list
        Cheetahtemplate-discuss@...
        https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
      • Tavis Rudd
        This works. Note that You should run pygettext on the Cheetah-generated .py files rather than on the .tmpl files. Tavis ... This sf.net email is sponsored
        Message 3 of 7 , Aug 6, 2002
        • 0 Attachment
          This works. Note that You should run pygettext on the Cheetah-generated .py
          files rather than on the .tmpl files.
          Tavis

          On August 6, 2002 10:35 pm, Huy Do wrote:
          > Hi All,
          >
          > Is there a recommended way of internationalizing templates.
          >
          > The easiest way I've come up with is to set internationlized strings
          > using #set then
          > Using the $string.
          >
          > Eg. #set $aString = _("This will be translated")
          >
          > Thanks
          >
          > Huy
          >
          >
          >
          > -------------------------------------------------------
          > This sf.net email is sponsored by:ThinkGeek
          > Welcome to geek heaven.
          > http://thinkgeek.com/sf
          > _______________________________________________
          > Cheetahtemplate-discuss mailing list
          > Cheetahtemplate-discuss@...
          > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss



          -------------------------------------------------------
          This sf.net email is sponsored by:ThinkGeek
          Welcome to geek heaven.
          http://thinkgeek.com/sf
          _______________________________________________
          Cheetahtemplate-discuss mailing list
          Cheetahtemplate-discuss@...
          https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
        • Huy Do
          Is there not a better way ? ... This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf
          Message 4 of 7 , Aug 6, 2002
          • 0 Attachment
            Is there not a better way ?

            Tavis Rudd wrote:

            >This works. Note that You should run pygettext on the Cheetah-generated .py
            >files rather than on the .tmpl files.
            >Tavis
            >
            >On August 6, 2002 10:35 pm, Huy Do wrote:
            >
            >
            >>Hi All,
            >>
            >>Is there a recommended way of internationalizing templates.
            >>
            >>The easiest way I've come up with is to set internationlized strings
            >>using #set then
            >>Using the $string.
            >>
            >>Eg. #set $aString = _("This will be translated")
            >>
            >>Thanks
            >>
            >>Huy
            >>
            >>
            >>
            >>-------------------------------------------------------
            >>This sf.net email is sponsored by:ThinkGeek
            >>Welcome to geek heaven.
            >>http://thinkgeek.com/sf
            >>_______________________________________________
            >>Cheetahtemplate-discuss mailing list
            >>Cheetahtemplate-discuss@...
            >>https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
            >>
            >>
            >
            >
            >
            >-------------------------------------------------------
            >This sf.net email is sponsored by:ThinkGeek
            >Welcome to geek heaven.
            >http://thinkgeek.com/sf
            >_______________________________________________
            >Cheetahtemplate-discuss mailing list
            >Cheetahtemplate-discuss@...
            >https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
            >
            >





            -------------------------------------------------------
            This sf.net email is sponsored by:ThinkGeek
            Welcome to geek heaven.
            http://thinkgeek.com/sf
            _______________________________________________
            Cheetahtemplate-discuss mailing list
            Cheetahtemplate-discuss@...
            https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
          • Tavis Rudd
            ... Not that I can think off. The pygettext tool is built to parse Python files not Cheetah files, although it might scrape by if you stick with single line
            Message 5 of 7 , Aug 6, 2002
            • 0 Attachment
              On August 6, 2002 11:53 pm, Huy Do wrote:
              > Is there not a better way ?

              Not that I can think off. The pygettext tool is built to parse Python files
              not Cheetah files, although it might scrape by if you stick with single line
              strings.

              > Tavis Rudd wrote:
              > >This works. Note that You should run pygettext on the Cheetah-generated
              > > .py files rather than on the .tmpl files.
              > >Tavis
              > >
              > >On August 6, 2002 10:35 pm, Huy Do wrote:
              > >>Hi All,
              > >>
              > >>Is there a recommended way of internationalizing templates.
              > >>
              > >>The easiest way I've come up with is to set internationlized strings
              > >>using #set then
              > >>Using the $string.
              > >>
              > >>Eg. #set $aString = _("This will be translated")
              > >>
              > >>Thanks
              > >>
              > >>Huy
              > >>
              > >>
              > >>
              > >>-------------------------------------------------------
              > >>This sf.net email is sponsored by:ThinkGeek
              > >>Welcome to geek heaven.
              > >>http://thinkgeek.com/sf
              > >>_______________________________________________
              > >>Cheetahtemplate-discuss mailing list
              > >>Cheetahtemplate-discuss@...
              > >>https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
              > >
              > >-------------------------------------------------------
              > >This sf.net email is sponsored by:ThinkGeek
              > >Welcome to geek heaven.
              > >http://thinkgeek.com/sf
              > >_______________________________________________
              > >Cheetahtemplate-discuss mailing list
              > >Cheetahtemplate-discuss@...
              > >https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss



              -------------------------------------------------------
              This sf.net email is sponsored by:ThinkGeek
              Welcome to geek heaven.
              http://thinkgeek.com/sf
              _______________________________________________
              Cheetahtemplate-discuss mailing list
              Cheetahtemplate-discuss@...
              https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
            • Tavis Rudd
              ... That should work. Is it possible that the #set global line isn t being executed before the $form.getFirst line? If you re still stuck on it send me your
              Message 6 of 7 , Aug 7, 2002
              • 0 Attachment
                On August 6, 2002 04:28 am, Paul Sorenson wrote:
                > I have a vanilla cgi template in which I want to access the cgi parameters
                > and I am stumbling on scoping.
                >
                > At the top of the template (after importing cgi) I have:
                > #set global $form = $cgi.FieldStorage()
                >
                > and then in the body of my template I have
                > $form.getFirst("foobar")
                >
                > At run time I get NameMapper.NotFound: form

                That should work. Is it possible that the #set global line isn't being
                executed before the $form.getFirst line? If you're still stuck on it send me
                your .tmpl files and I'll take a closer look.

                > Now even if there is something that is predefined to help me with CGI
                > headers (I haven't been able to make the docs from the tex source yet - but
                > feel free to set me straight) I would still like to understand the scope of
                > "#set" and "#set global"

                There's little bit on it at:
                http://cheetahtemplate.org/docs/users_guide_html/users_guide.html#SECTION000840000000000000000

                Tavis


                -------------------------------------------------------
                This sf.net email is sponsored by:ThinkGeek
                Welcome to geek heaven.
                http://thinkgeek.com/sf
                _______________________________________________
                Cheetahtemplate-discuss mailing list
                Cheetahtemplate-discuss@...
                https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
              • Mike Orr
                ... We ve tried to think of better ways to handle multilingual documents but haven t come up with any. Some documents may work best with parallel templates,
                Message 7 of 7 , Aug 7, 2002
                • 0 Attachment
                  On Tue, Aug 06, 2002 at 11:58:10PM -0700, Tavis Rudd wrote:
                  > On August 6, 2002 11:53 pm, Huy Do wrote:
                  > > Is there not a better way ?
                  >
                  > Not that I can think off. The pygettext tool is built to parse Python files
                  > not Cheetah files, although it might scrape by if you stick with single line
                  > strings.

                  We've tried to think of better ways to handle multilingual documents
                  but haven't come up with any.

                  Some documents may work best with parallel templates, one for each
                  language. Others may be able to get by with #block methods and
                  subclasses for the different languages.

                  Beyond that, we'd need somebody who uses multilingual documents to
                  tell us what would make their life easier.

                  --
                  -Mike (Iron) Orr, iron@... (if mail problems: mso@...)
                  http://iron.cx/ English * Esperanto * Russkiy * Deutsch * Espan~ol


                  -------------------------------------------------------
                  This sf.net email is sponsored by:ThinkGeek
                  Welcome to geek heaven.
                  http://thinkgeek.com/sf
                  _______________________________________________
                  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.