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

[Cheetahtemplate-discuss] Searchpath for #include

Expand Messages
  • Achim Domma
    Hi, how looks Cheetah for files which are included with #include . Is there a way to specify a base location for relative pathes? regards, Achim ... This
    Message 1 of 6 , Feb 4, 2003
    • 0 Attachment
      Hi,

      how looks Cheetah for files which are included with '#include'. Is there a
      way to specify a base location for relative pathes?

      regards,
      Achim



      -------------------------------------------------------
      This SF.NET email is sponsored by:
      SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
      http://www.vasoftware.com
      _______________________________________________
      Cheetahtemplate-discuss mailing list
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    • Tavis Rudd
      Hi Achim, you can override your template baseclass .serverSidePath method to achieve this. Cheetah templates call self.serverSidePath on all paths in
      Message 2 of 6 , Feb 4, 2003
      • 0 Attachment
        Hi Achim,
        you can override your template baseclass' .serverSidePath method to achieve
        this. Cheetah templates call self.serverSidePath on all paths in #includes.
        See Cheetah-0.9.x/src/Servlet.py for the baseclass that provides this method.
        Cheers,
        Tavis

        On February 4, 2003 11:27 pm, Achim Domma wrote:
        > Hi,
        >
        > how looks Cheetah for files which are included with '#include'. Is there a
        > way to specify a base location for relative pathes?
        >
        > regards,
        > Achim
        >
        >
        >
        > -------------------------------------------------------
        > This SF.NET email is sponsored by:
        > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
        > http://www.vasoftware.com
        > _______________________________________________
        > Cheetahtemplate-discuss mailing list
        > Cheetahtemplate-discuss@...
        > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss



        -------------------------------------------------------
        This SF.NET email is sponsored by:
        SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
        http://www.vasoftware.com
        _______________________________________________
        Cheetahtemplate-discuss mailing list
        Cheetahtemplate-discuss@...
        https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
      • Achim Domma
        Hi Tavis, thanks for your fast answer! ... Just to be sure: The path argument passed to self.serverSidePath is the argument of the #import directive and the
        Message 3 of 6 , Feb 5, 2003
        • 0 Attachment
          Hi Tavis,

          thanks for your fast answer!

          > you can override your template baseclass' .serverSidePath method
          > to achieve
          > this. Cheetah templates call self.serverSidePath on all paths in
          > #includes.
          > See Cheetah-0.9.x/src/Servlet.py for the baseclass that provides
          > this method.

          Just to be sure: The path argument passed to self.serverSidePath is the
          argument of the #import directive and the function has to return the
          absolute local path to the file. Is this true? Then it should be possible to
          do something like:

          absPath = join(customerFolder,path)
          if isfile(absPath):
          return absPath
          absPath = join(defaultFolder,path)
          if isfile(absPath):
          return absPath
          # possible more search folders
          # ...
          return None

          Looks such a solution ok to you? Or is there a better place to achive
          something like that.

          Achim



          -------------------------------------------------------
          This SF.NET email is sponsored by:
          SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
          http://www.vasoftware.com
          _______________________________________________
          Cheetahtemplate-discuss mailing list
          Cheetahtemplate-discuss@...
          https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
        • Tavis Rudd
          Yep that should work, though I haven t tested it. I have a strong gut reaction against designs involving #include so I ve never actually used it outside of
          Message 4 of 6 , Feb 5, 2003
          • 0 Attachment
            Yep that should work, though I haven't tested it. I have a strong gut
            reaction against designs involving #include so I've never actually used it
            outside of creating it.

            On February 5, 2003 12:49 am, Achim Domma wrote:
            > Hi Tavis,
            >
            > thanks for your fast answer!
            >
            > > you can override your template baseclass' .serverSidePath method
            > > to achieve
            > > this. Cheetah templates call self.serverSidePath on all paths in
            > > #includes.
            > > See Cheetah-0.9.x/src/Servlet.py for the baseclass that provides
            > > this method.
            >
            > Just to be sure: The path argument passed to self.serverSidePath is the
            > argument of the #import directive and the function has to return the
            > absolute local path to the file. Is this true? Then it should be possible
            > to do something like:
            >
            > absPath = join(customerFolder,path)
            > if isfile(absPath):
            > return absPath
            > absPath = join(defaultFolder,path)
            > if isfile(absPath):
            > return absPath
            > # possible more search folders
            > # ...
            > return None
            >
            > Looks such a solution ok to you? Or is there a better place to achive
            > something like that.
            >
            > Achim
            >
            >
            >
            > -------------------------------------------------------
            > This SF.NET email is sponsored by:
            > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
            > http://www.vasoftware.com
            > _______________________________________________
            > Cheetahtemplate-discuss mailing list
            > Cheetahtemplate-discuss@...
            > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss



            -------------------------------------------------------
            This SF.NET email is sponsored by:
            SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
            http://www.vasoftware.com
            _______________________________________________
            Cheetahtemplate-discuss mailing list
            Cheetahtemplate-discuss@...
            https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
          • Jaroslaw Zabiello
            ... Hmm, could you give me any working example? I am not using Webware. I am using Spyce. The example is: [[.import name=template]] [[import sys]]
            Message 5 of 6 , May 15, 2003
            • 0 Attachment
              On 2003-02-05 09:31:03 Tavis Rudd <tavis@...> wrote:

              >> how looks Cheetah for files which are included with '#include'. Is
              >> there a way to specify a base location for relative pathes?
              >
              > you can override your template baseclass' .serverSidePath method to
              > achieve this. Cheetah templates call self.serverSidePath on all
              > paths in #includes. See Cheetah-0.9.x/src/Servlet.py for the
              > baseclass that provides this method.

              Hmm, could you give me any working example? I am not using Webware. I
              am using Spyce. The example is:

              [[.import name=template]]
              [[import sys]]
              <html><body>
              The template module interfaces with various templating
              engines. <br>
              It currently supports:
              <a href="http://www.cheetahtemplate.org">Cheetah</a>
              <hr>

              [[
              persona = 'world'
              num = 10
              ]]
              <b>Cheetah template:</b><br>
              [[ try: { ]]
              [[=template.cheetah('template.tmpl')]]
              [[ } except ImportError: { ]]
              Unable to import Cheetah.Compiler from path=[[=sys.path]]
              <br><b>The Cheetah is likely not (properly) installed.</b>
              [[ } ]]
              <p>

              </body></html>

              How to make a base location for #include in this situation?

              --
              Jarosław Zabiełło (ICQ: 6712522)




              -------------------------------------------------------
              Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
              The only event dedicated to issues related to Linux enterprise solutions
              www.enterpriselinuxforum.com

              _______________________________________________
              Cheetahtemplate-discuss mailing list
              Cheetahtemplate-discuss@...
              https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
            • Jaroslaw Zabiello
              I forgot to explain, that file template.tmpl contains: blah1 #include otherfile.tmpl blah2 -- Jaros³aw Zabie³³o (UIN: 6712522) ... Enterprise Linux Forum
              Message 6 of 6 , May 15, 2003
              • 0 Attachment
                I forgot to explain, that file template.tmpl contains:

                blah1
                #include "otherfile.tmpl"
                blah2

                --
                Jarosław Zabiełło (UIN: 6712522)






                -------------------------------------------------------
                Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
                The only event dedicated to issues related to Linux enterprise solutions
                www.enterpriselinuxforum.com

                _______________________________________________
                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.