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

[Cheetahtemplate-discuss] Oddities with Cheetah #include's and #def's...

Expand Messages
  • Tracy S. Ruggles
    Hi, I m seeing some strange behavior with my template files (in use with Webware) and wanted to see if any of you have seen the same thing. I have a complex
    Message 1 of 11 , Mar 25, 2002
      Hi,

      I'm seeing some strange behavior with my template files (in use with
      Webware) and wanted to see if any of you have seen the same thing.
      I have a complex set of pages where this particular problem is
      happening, but I've distilled it down to a few simple templates in
      this example and was able to reproduce the behavior.

      In this example, I have one master template, '_master.tmpl' that
      defines three sections/placeholders for a document and provides the
      initial values via #def directives.

      Then, I have a sample page, '_pageA.tmpl' that #extends the master
      template and re-defines the second section with a #block directive.

      Here's the problem: every once in a while, sections one and three
      may or not actually be sections one and three. Sometimes one will
      be three and vice versa, but never do they actually swap places,
      i.e. it never happens that I get Three/Two/One, just sometimes
      Three/Two/Three and One/Two/One. In my actual set of pages, I'm
      define seven placeholders in the master template and only the
      placeholders that weren't over-ridden in the sub-pages exhibit this
      behavior.

      Below is the code for each of the 5 files mentioned above (separated
      with a line of dashes). Am I not properly using the various
      directives, or is there a better way to define default values for
      certain placeholders?

      I'm currently using Python 2.2, Webware 0.7b2 and Cheetah 0.9.11
      (cvs as of 3/25) -- and using cheetah-compile to create .py servlets.

      Thanks!

      --Tracy

      NOTE: I have created a test that doesn't use Webware and just
      #includes the files directly, calling the script like %python
      _pageA.py -- and this problem *doesn't* happen.

      ----------
      ## _master.tmpl
      #def $sectionOne
      #include $request.serverSideContextPath + '/_sectionOne.tmpl'
      #end def
      #def $sectionTwo
      #include $request.serverSideContextPath + '/_sectionTwo.tmpl'
      #end def
      #def $sectionThree
      #include $request.serverSideContextPath + '/_sectionThree.tmpl'
      #end def
      <HTML><BODY>
      $sectionOne
      <P><HR></P>
      $sectionTwo
      <P><HR></P>
      $sectionThree
      </BODY></HTML>

      ----------
      ## _pageA.tmpl

      #from _master import _master
      #extends _master

      #block sectionTwo
      <P>This is my custom content for section Two.</P>
      #end block

      ----------
      ## _sectionOne.tmpl
      <P>The default section One.</P>

      ----------
      ## _sectionTwo.tmpl
      <P>The default section Two.</P>

      ----------
      ## _sectionThree.tmpl
      <P>The default section Three.</P>

      ----------


      --
      Tracy S. Ruggles -- tr@... -- 888/999-2674 x TR
      OutputLinks -- http://www.outputlinks.com
      "Your Output Industry Portal"


      _______________________________________________
      Cheetahtemplate-discuss mailing list
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    • Mike Orr
      Please send Cheetah problems to the Cheetah list, even if it s related to a servlet. That way we don t bother the Webware users who don t use Cheetah. ... It
      Message 2 of 11 , Mar 25, 2002
        Please send Cheetah problems to the Cheetah list, even if it's
        related to a servlet. That way we don't bother the Webware
        users who don't use Cheetah.

        On Mon, Mar 25, 2002 at 05:50:41PM -0600, Tracy S. Ruggles wrote:
        > Here's the problem: every once in a while, sections one and three
        > may or not actually be sections one and three. Sometimes one will
        > be three and vice versa, but never do they actually swap places,
        > i.e. it never happens that I get Three/Two/One, just sometimes
        > Three/Two/Three and One/Two/One. In my actual set of pages, I'm
        > define seven placeholders in the master template and only the
        > placeholders that weren't over-ridden in the sub-pages exhibit this
        > behavior.

        It looks like you have #def and #block reversed. #block belongs
        in the parent template, _master.tmpl:

        #block sectionTwo
        <P> This block has not been overridden.</P>
        #end block

        This both sets the location of the output and provides default
        text. Then the child template may do (or not do):

        #def sectionTwo
        <P>This is my custom content for section Two.</P>
        #end def

        It's possible to use #def in the parent too, but then you have to
        explicitly set the location of the output:

        $sectionTwo

        or it won't appear at all. If Cheetah encounters '$sectionTwo'
        before '#def sectionTwo' it *should* raise a NameMapper.NotFound
        exception, but perhaps something is happening in the way the
        parent and child templates are being processed under Webware.

        Try replacing the '$section*' in _master.tmpl with #block's,
        and using #def in _pageA.tmpl, and getting rid of the
        '#def ... #include ... #end def' constructs, and see if that
        clears up your problem.

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

        _______________________________________________
        Cheetahtemplate-discuss mailing list
        Cheetahtemplate-discuss@...
        https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
      • Mike Orr
        ... Oops, that s not true. #def is processed at compile time, whereas $sectionTwo is evaluated at run time. But still, using #block is simpler. --
        Message 3 of 11 , Mar 25, 2002
          On Mon, Mar 25, 2002 at 04:46:03PM -0800, Mike Orr wrote:
          > If Cheetah encounters '$sectionTwo'
          > before '#def sectionTwo' it *should* raise a NameMapper.NotFound
          > exception

          Oops, that's not true. '#def' is processed at compile time,
          whereas '$sectionTwo' is evaluated at run time. But still,
          using '#block' is simpler.

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

          _______________________________________________
          Cheetahtemplate-discuss mailing list
          Cheetahtemplate-discuss@...
          https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
        • Tavis Rudd
          ... Actually, that s not correct. Cheetah compiles in one pass, then Python parses/interprets in another. The order of #defs and $placeholders is of no
          Message 4 of 11 , Mar 25, 2002
            On Monday 25 March 2002 16:46, Mike Orr wrote:
            > If Cheetah encounters '$sectionTwo'
            > before '#def sectionTwo' it *should* raise a NameMapper.NotFound
            > exception, but perhaps something is happening in the way the
            > parent and child templates are being processed under Webware.

            Actually, that's not correct. Cheetah compiles in one pass, then
            Python parses/interprets in another. The order of #defs and
            $placeholders is of no consequence.

            I haven't had a chance to look into the rest of this thoroughly yet.

            Tavis


            > On Mon, Mar 25, 2002 at 05:50:41PM -0600, Tracy S. Ruggles wrote:
            > > Here's the problem: every once in a while, sections one and three
            > > may or not actually be sections one and three. Sometimes one
            > > will be three and vice versa, but never do they actually swap
            > > places, i.e. it never happens that I get Three/Two/One, just
            > > sometimes Three/Two/Three and One/Two/One. In my actual set of
            > > pages, I'm define seven placeholders in the master template and
            > > only the placeholders that weren't over-ridden in the sub-pages
            > > exhibit this behavior.
            >
            > It looks like you have #def and #block reversed. #block belongs
            > in the parent template, _master.tmpl:
            >
            > #block sectionTwo
            > <P> This block has not been overridden.</P>
            > #end block
            >
            > This both sets the location of the output and provides default
            > text. Then the child template may do (or not do):
            >
            > #def sectionTwo
            > <P>This is my custom content for section Two.</P>
            > #end def
            >
            > It's possible to use #def in the parent too, but then you have to
            > explicitly set the location of the output:
            >
            > $sectionTwo
            >
            > or it won't appear at all.


            > Try replacing the '$section*' in _master.tmpl with #block's,
            > and using #def in _pageA.tmpl, and getting rid of the
            > '#def ... #include ... #end def' constructs, and see if that
            > clears up your problem.

            _______________________________________________
            Cheetahtemplate-discuss mailing list
            Cheetahtemplate-discuss@...
            https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
          • Tavis Rudd
            Tracy, I won t have a chance to look at this for a few hours, but the following notes might help you in the meantime: - the problem is probably related to the
            Message 5 of 11 , Mar 25, 2002
              Tracy,
              I won't have a chance to look at this for a few hours, but the
              following notes might help you in the meantime:

              - the problem is probably related to the
              Template._includeCheetahSource() method in Template.py line 361.

              - the line
              includeID = id(srcArg)
              is probably the culprit. It might not be producing unique ids for
              each file.

              - you can experiment with this by adding something like:
              print includeID, srcArg
              after that line.

              Cheers,
              Tavis


              On Monday 25 March 2002 15:50, Tracy S. Ruggles wrote:
              > Hi,
              >
              > I'm seeing some strange behavior with my template files (in use
              > with Webware) and wanted to see if any of you have seen the same
              > thing. I have a complex set of pages where this particular problem
              > is happening, but I've distilled it down to a few simple templates
              > in this example and was able to reproduce the behavior.
              >
              > In this example, I have one master template, '_master.tmpl' that
              > defines three sections/placeholders for a document and provides the
              > initial values via #def directives.
              >
              > Then, I have a sample page, '_pageA.tmpl' that #extends the master
              > template and re-defines the second section with a #block directive.
              >
              > Here's the problem: every once in a while, sections one and three
              > may or not actually be sections one and three. Sometimes one will
              > be three and vice versa, but never do they actually swap places,
              > i.e. it never happens that I get Three/Two/One, just sometimes
              > Three/Two/Three and One/Two/One. In my actual set of pages, I'm
              > define seven placeholders in the master template and only the
              > placeholders that weren't over-ridden in the sub-pages exhibit this
              > behavior.
              >
              > Below is the code for each of the 5 files mentioned above
              > (separated with a line of dashes). Am I not properly using the
              > various directives, or is there a better way to define default
              > values for certain placeholders?
              >
              > I'm currently using Python 2.2, Webware 0.7b2 and Cheetah 0.9.11
              > (cvs as of 3/25) -- and using cheetah-compile to create .py
              > servlets.
              >
              > Thanks!
              >
              > --Tracy
              >
              > NOTE: I have created a test that doesn't use Webware and just
              > #includes the files directly, calling the script like %python
              > _pageA.py -- and this problem *doesn't* happen.
              >
              > ----------
              > ## _master.tmpl
              > #def $sectionOne
              > #include $request.serverSideContextPath + '/_sectionOne.tmpl'
              > #end def
              > #def $sectionTwo
              > #include $request.serverSideContextPath + '/_sectionTwo.tmpl'
              > #end def
              > #def $sectionThree
              > #include $request.serverSideContextPath + '/_sectionThree.tmpl'
              > #end def
              > <HTML><BODY>
              > $sectionOne
              > <P><HR></P>
              > $sectionTwo
              > <P><HR></P>
              > $sectionThree
              > </BODY></HTML>
              >
              > ----------
              > ## _pageA.tmpl
              >
              > #from _master import _master
              > #extends _master
              >
              > #block sectionTwo
              > <P>This is my custom content for section Two.</P>
              > #end block
              >
              > ----------
              > ## _sectionOne.tmpl
              > <P>The default section One.</P>
              >
              > ----------
              > ## _sectionTwo.tmpl
              > <P>The default section Two.</P>
              >
              > ----------
              > ## _sectionThree.tmpl
              > <P>The default section Three.</P>
              >
              > ----------

              _______________________________________________
              Cheetahtemplate-discuss mailing list
              Cheetahtemplate-discuss@...
              https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
            • Tracy S. Ruggles
              Here s an interesting interactive sequence I had with the interpreter. The first time I used the id built-in function, it told me that two separate
              Message 6 of 11 , Mar 26, 2002
                Here's an interesting interactive sequence I had with the
                interpreter. The first time I used the 'id' built-in function, it
                told me that two separate instances were the same. Yet, after I
                created a couple of other instances and tried the same thing, it
                said that the instances were different...

                >>> class y: pass
                ...
                >>> id(y()) == id(y())
                1
                >>> a = y()
                >>> b = y()
                >>> a == b
                0
                >>> a,b = y(), y()
                >>> a == b
                0
                >>> id(a) == id(b)
                0
                >>> id(a)
                3207452
                >>> id(b)
                3113724
                >>> id(y())
                3113772
                >>> id(y())
                3113596
                >>> id(y()) == id(y())
                0
                >>>

                I don't know if this is pointing to some problem with my build of
                Python 2.2 or if this is something wrong with the 'id' function (or,
                maybe this is just the expected behavior), but I think this is what
                may be happening in the _includeCheetahSource() function.

                I don't know if you've been able to reproduce this problem, but I'm
                guessing that the Cheetah code is fine and that something went awry
                with my python installation. I'm on Mac OS 10.1.3, with the most
                recent source for 2.2.

                --Tracy

                P.S. Before sending off this email, I tried the exact same sequence
                of steps with the interpreter as listed above, and I got a '1' on
                the last id(y()) == id(y()). And then I did this:

                >>> class x: pass
                ...
                >>> id(x()) == id(y()) # !!! what happened here?
                1
                >>> id(y()) == id(y())
                1
                >>> id(x())
                3065196
                >>> id(y())
                3065228
                >>>


                On Monday, March 25, 2002, at 08:22 PM, Tavis Rudd wrote:

                > Tracy,
                > I won't have a chance to look at this for a few hours, but the
                > following notes might help you in the meantime:
                >
                > - the problem is probably related to the
                > Template._includeCheetahSource() method in Template.py line 361.
                >
                > - the line
                > includeID = id(srcArg)
                > is probably the culprit. It might not be producing unique ids for
                > each file.
                >
                > - you can experiment with this by adding something like:
                > print includeID, srcArg
                > after that line.
                >
                > Cheers,
                > Tavis
                >
                >
                > On Monday 25 March 2002 15:50, Tracy S. Ruggles wrote:
                >> Hi,
                >>
                >> I'm seeing some strange behavior with my template files (in use
                >> with Webware) and wanted to see if any of you have seen the same
                >> thing. I have a complex set of pages where this particular problem
                >> is happening, but I've distilled it down to a few simple templates
                >> in this example and was able to reproduce the behavior.
                >>
                >> In this example, I have one master template, '_master.tmpl' that
                >> defines three sections/placeholders for a document and provides the
                >> initial values via #def directives.
                >>
                >> Then, I have a sample page, '_pageA.tmpl' that #extends the master
                >> template and re-defines the second section with a #block directive.
                >>
                >> Here's the problem: every once in a while, sections one and three
                >> may or not actually be sections one and three. Sometimes one will
                >> be three and vice versa, but never do they actually swap places,
                >> i.e. it never happens that I get Three/Two/One, just sometimes
                >> Three/Two/Three and One/Two/One. In my actual set of pages, I'm
                >> define seven placeholders in the master template and only the
                >> placeholders that weren't over-ridden in the sub-pages exhibit this
                >> behavior.
                >>
                >> Below is the code for each of the 5 files mentioned above
                >> (separated with a line of dashes). Am I not properly using the
                >> various directives, or is there a better way to define default
                >> values for certain placeholders?
                >>
                >> I'm currently using Python 2.2, Webware 0.7b2 and Cheetah 0.9.11
                >> (cvs as of 3/25) -- and using cheetah-compile to create .py
                >> servlets.
                >>
                >> Thanks!
                >>
                >> --Tracy
                >>
                >> NOTE: I have created a test that doesn't use Webware and just
                >> #includes the files directly, calling the script like %python
                >> _pageA.py -- and this problem *doesn't* happen.
                >>
                >> ----------
                >> ## _master.tmpl
                >> #def $sectionOne
                >> #include $request.serverSideContextPath + '/_sectionOne.tmpl'
                >> #end def
                >> #def $sectionTwo
                >> #include $request.serverSideContextPath + '/_sectionTwo.tmpl'
                >> #end def
                >> #def $sectionThree
                >> #include $request.serverSideContextPath + '/_sectionThree.tmpl'
                >> #end def
                >> <HTML><BODY>
                >> $sectionOne
                >> <P><HR></P>
                >> $sectionTwo
                >> <P><HR></P>
                >> $sectionThree
                >> </BODY></HTML>
                >>
                >> ----------
                >> ## _pageA.tmpl
                >>
                >> #from _master import _master
                >> #extends _master
                >>
                >> #block sectionTwo
                >> <P>This is my custom content for section Two.</P>
                >> #end block
                >>
                >> ----------
                >> ## _sectionOne.tmpl
                >> <P>The default section One.</P>
                >>
                >> ----------
                >> ## _sectionTwo.tmpl
                >> <P>The default section Two.</P>
                >>
                >> ----------
                >> ## _sectionThree.tmpl
                >> <P>The default section Three.</P>
                >>
                >> ----------
                >
                > _______________________________________________
                > Cheetahtemplate-discuss mailing list
                > Cheetahtemplate-discuss@...
                > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
                >
                >
                --
                Tracy S. Ruggles -- tr@... -- 888/999-2674 x TR
                OutputLinks -- http://www.outputlinks.com
                "Your Output Industry Portal"


                _______________________________________________
                Cheetahtemplate-discuss mailing list
                Cheetahtemplate-discuss@...
                https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
              • Mike Orr
                ... This is funny. Since instances are mutable, every instance should have a distinct ID. It must be a subtlety of that expression: perhaps it means
                Message 7 of 11 , Mar 26, 2002
                  On Tue, Mar 26, 2002 at 08:32:32AM -0600, Tracy S. Ruggles wrote:
                  > >>> class y: pass
                  > ...
                  > >>> id(y()) == id(y())
                  > 1

                  This is funny. Since instances are mutable, every instance should have
                  a distinct ID. It must be a subtlety of that expression: perhaps it means
                  something different than it appears to. Or maybe Python is doing an
                  optimizing shortcut that it shouldn't me.

                  > >>> a = y()
                  > >>> b = y()
                  > >>> a == b
                  > 0
                  > >>> a,b = y(), y()
                  > >>> a == b
                  > 0
                  > >>> id(a) == id(b)
                  > 0
                  > >>> id(a)
                  > 3207452
                  > >>> id(b)
                  > 3113724
                  > >>> id(y())
                  > 3113772
                  > >>> id(y())
                  > 3113596
                  > >>> id(y()) == id(y())
                  > 0
                  > >>>

                  Weirder, I tried this and I got the same ID for the two starred lines.

                  >>> id(a)
                  135570548
                  >>> id(b)
                  135574484
                  >>> id(y())
                  135572884 *
                  >>> id(y())
                  135572884 *
                  >>> id(y()) == id(y())
                  1

                  This is with Python 2.2 stable:

                  % python
                  Python 2.2 (#10, Jan 2 2002, 01:37:36)
                  [GCC 2.95.4 20011006 (Debian prerelease)] on linux2
                  Type "help", "copyright", "credits" or "license" for more information.


                  Perhaps we should avoid id() because it seems to have some
                  inconsistencies.


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

                  _______________________________________________
                  Cheetahtemplate-discuss mailing list
                  Cheetahtemplate-discuss@...
                  https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
                • Federico Di Gregorio
                  ... i think it can be right. id() prints a non-unique identifier and when the second id() is executes, the first instance of y is already gone. so the second
                  Message 8 of 11 , Mar 26, 2002
                    Il mar, 2002-03-26 alle 17:32, Mike Orr ha scritto:
                    > On Tue, Mar 26, 2002 at 08:32:32AM -0600, Tracy S. Ruggles wrote:
                    > > >>> class y: pass
                    > > ...
                    > > >>> id(y()) == id(y())
                    > > 1
                    >
                    > This is funny. Since instances are mutable, every instance should have
                    > a distinct ID. It must be a subtlety of that expression: perhaps it means
                    > something different than it appears to. Or maybe Python is doing an
                    > optimizing shortcut that it shouldn't me.

                    i think it can be right. id() prints a non-unique identifier and when
                    the second id() is executes, the first instance of y is already gone. so
                    the second instance of y can share the same address ans if id uses that
                    address as part of the calculation...

                    --
                    Federico Di Gregorio
                    Debian GNU/Linux Developer & Italian Press Contact fog@...
                    INIT.D Developer fog@...
                    The devil speaks truth much oftener than he's deemed.
                    He has an ignorant audience. -- Byron (suggested by Alice Fontana)
                  • Patrick K. O'Brien
                    [Federico Di Gregorio] ... This behavior makes sense if you read the docstring for id(). id(object) - integer Return the identity of an object. This is
                    Message 9 of 11 , Mar 26, 2002
                      [Federico Di Gregorio]
                      >
                      > Il mar, 2002-03-26 alle 17:32, Mike Orr ha scritto:
                      > > On Tue, Mar 26, 2002 at 08:32:32AM -0600, Tracy S. Ruggles wrote:
                      > > > >>> class y: pass
                      > > > ...
                      > > > >>> id(y()) == id(y())
                      > > > 1
                      > >
                      > > This is funny. Since instances are mutable, every instance should have
                      > > a distinct ID. It must be a subtlety of that expression:
                      > perhaps it means
                      > > something different than it appears to. Or maybe Python is doing an
                      > > optimizing shortcut that it shouldn't me.
                      >
                      > i think it can be right. id() prints a non-unique identifier and when
                      > the second id() is executes, the first instance of y is already gone. so
                      > the second instance of y can share the same address ans if id uses that
                      > address as part of the calculation...

                      This behavior makes sense if you read the docstring for id().

                      """id(object) -> integer

                      Return the identity of an object. This is guaranteed to be unique among
                      simultaneously existing objects. (Hint: it's the object's memory address.)
                      """

                      ---
                      Patrick K. O'Brien
                      Orbtech

                      _______________________________________________
                      Cheetahtemplate-discuss mailing list
                      Cheetahtemplate-discuss@...
                      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
                    • Tavis Rudd
                      Yep, id() was being used in the wrong way. This is fixed in the CVS now. ... _______________________________________________ Cheetahtemplate-discuss mailing
                      Message 10 of 11 , Mar 26, 2002
                        Yep, id() was being used in the wrong way. This is fixed in the CVS
                        now.


                        On Tuesday 26 March 2002 06:32, Tracy S. Ruggles wrote:
                        > Here's an interesting interactive sequence I had with the
                        > interpreter. The first time I used the 'id' built-in function, it
                        > told me that two separate instances were the same. Yet, after I
                        > created a couple of other instances and tried the same thing, it
                        > said that the instances were different...
                        >
                        > >>> class y: pass
                        >
                        > ...
                        >
                        > >>> id(y()) == id(y())
                        >
                        > 1
                        >
                        > >>> a = y()
                        > >>> b = y()
                        > >>> a == b
                        >
                        > 0
                        >
                        > >>> a,b = y(), y()
                        > >>> a == b
                        >
                        > 0
                        >
                        > >>> id(a) == id(b)
                        >
                        > 0
                        >
                        > >>> id(a)
                        >
                        > 3207452
                        >
                        > >>> id(b)
                        >
                        > 3113724
                        >
                        > >>> id(y())
                        >
                        > 3113772
                        >
                        > >>> id(y())
                        >
                        > 3113596
                        >
                        > >>> id(y()) == id(y())
                        >
                        > 0
                        >
                        >
                        > I don't know if this is pointing to some problem with my build of
                        > Python 2.2 or if this is something wrong with the 'id' function
                        > (or, maybe this is just the expected behavior), but I think this
                        > is what may be happening in the _includeCheetahSource() function.
                        >
                        > I don't know if you've been able to reproduce this problem, but I'm
                        > guessing that the Cheetah code is fine and that something went awry
                        > with my python installation. I'm on Mac OS 10.1.3, with the most
                        > recent source for 2.2.
                        >
                        > --Tracy
                        >
                        > P.S. Before sending off this email, I tried the exact same sequence
                        > of steps with the interpreter as listed above, and I got a '1' on
                        >
                        > the last id(y()) == id(y()). And then I did this:
                        > >>> class x: pass
                        >
                        > ...
                        >
                        > >>> id(x()) == id(y()) # !!! what happened here?
                        >
                        > 1
                        >
                        > >>> id(y()) == id(y())
                        >
                        > 1
                        >
                        > >>> id(x())
                        >
                        > 3065196
                        >
                        > >>> id(y())
                        >
                        > 3065228
                        >
                        > On Monday, March 25, 2002, at 08:22 PM, Tavis Rudd wrote:
                        > > Tracy,
                        > > I won't have a chance to look at this for a few hours, but the
                        > > following notes might help you in the meantime:
                        > >
                        > > - the problem is probably related to the
                        > > Template._includeCheetahSource() method in Template.py line 361.
                        > >
                        > > - the line
                        > > includeID = id(srcArg)
                        > > is probably the culprit. It might not be producing unique ids
                        > > for each file.
                        > >
                        > > - you can experiment with this by adding something like:
                        > > print includeID, srcArg
                        > > after that line.
                        > >
                        > > Cheers,
                        > > Tavis
                        > >
                        > > On Monday 25 March 2002 15:50, Tracy S. Ruggles wrote:
                        > >> Hi,
                        > >>
                        > >> I'm seeing some strange behavior with my template files (in use
                        > >> with Webware) and wanted to see if any of you have seen the same
                        > >> thing. I have a complex set of pages where this particular
                        > >> problem is happening, but I've distilled it down to a few simple
                        > >> templates in this example and was able to reproduce the
                        > >> behavior.
                        > >>
                        > >> In this example, I have one master template, '_master.tmpl' that
                        > >> defines three sections/placeholders for a document and provides
                        > >> the initial values via #def directives.
                        > >>
                        > >> Then, I have a sample page, '_pageA.tmpl' that #extends the
                        > >> master template and re-defines the second section with a #block
                        > >> directive.
                        > >>
                        > >> Here's the problem: every once in a while, sections one and
                        > >> three may or not actually be sections one and three. Sometimes
                        > >> one will be three and vice versa, but never do they actually
                        > >> swap places, i.e. it never happens that I get Three/Two/One,
                        > >> just sometimes Three/Two/Three and One/Two/One. In my actual
                        > >> set of pages, I'm define seven placeholders in the master
                        > >> template and only the placeholders that weren't over-ridden in
                        > >> the sub-pages exhibit this behavior.
                        > >>
                        > >> Below is the code for each of the 5 files mentioned above
                        > >> (separated with a line of dashes). Am I not properly using the
                        > >> various directives, or is there a better way to define default
                        > >> values for certain placeholders?
                        > >>
                        > >> I'm currently using Python 2.2, Webware 0.7b2 and Cheetah 0.9.11
                        > >> (cvs as of 3/25) -- and using cheetah-compile to create .py
                        > >> servlets.
                        > >>
                        > >> Thanks!
                        > >>
                        > >> --Tracy
                        > >>
                        > >> NOTE: I have created a test that doesn't use Webware and just
                        > >> #includes the files directly, calling the script like %python
                        > >> _pageA.py -- and this problem *doesn't* happen.
                        > >>
                        > >> ----------
                        > >> ## _master.tmpl
                        > >> #def $sectionOne
                        > >> #include $request.serverSideContextPath + '/_sectionOne.tmpl'
                        > >> #end def
                        > >> #def $sectionTwo
                        > >> #include $request.serverSideContextPath + '/_sectionTwo.tmpl'
                        > >> #end def
                        > >> #def $sectionThree
                        > >> #include $request.serverSideContextPath + '/_sectionThree.tmpl'
                        > >> #end def
                        > >> <HTML><BODY>
                        > >> $sectionOne
                        > >> <P><HR></P>
                        > >> $sectionTwo
                        > >> <P><HR></P>
                        > >> $sectionThree
                        > >> </BODY></HTML>
                        > >>
                        > >> ----------
                        > >> ## _pageA.tmpl
                        > >>
                        > >> #from _master import _master
                        > >> #extends _master
                        > >>
                        > >> #block sectionTwo
                        > >> <P>This is my custom content for section Two.</P>
                        > >> #end block
                        > >>
                        > >> ----------
                        > >> ## _sectionOne.tmpl
                        > >> <P>The default section One.</P>
                        > >>
                        > >> ----------
                        > >> ## _sectionTwo.tmpl
                        > >> <P>The default section Two.</P>
                        > >>
                        > >> ----------
                        > >> ## _sectionThree.tmpl
                        > >> <P>The default section Three.</P>
                        > >>
                        > >> ----------
                        > >
                        > > _______________________________________________
                        > > Cheetahtemplate-discuss mailing list
                        > > Cheetahtemplate-discuss@...
                        > > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-disc
                        > >uss

                        _______________________________________________
                        Cheetahtemplate-discuss mailing list
                        Cheetahtemplate-discuss@...
                        https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
                      • Chuck Esterbrook
                        ... Yeah, but you ll bother the Cheetah users that don t use Webware. ;-) -Chuck _______________________________________________ Cheetahtemplate-discuss
                        Message 11 of 11 , Mar 29, 2002
                          On Monday 25 March 2002 04:46 pm, Mike Orr wrote:
                          > Please send Cheetah problems to the Cheetah list, even if it's
                          > related to a servlet. That way we don't bother the Webware
                          > users who don't use Cheetah.

                          Yeah, but you'll bother the Cheetah users that don't use Webware. ;-)

                          -Chuck

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