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

[Cheetahtemplate-discuss] Bug?: Difference between python and C NameMapper

Expand Messages
  • Bernt Røskar Brenna
    The case: A base template (basetemplate.tmpl) with a method: #def viewdef(c, dburi) ... #end def A inherited template: #from basetemplate import basetemplate
    Message 1 of 2 , May 29, 2008
    • 0 Attachment
      The case:

      A base template (basetemplate.tmpl) with a method:

      #def viewdef(c, dburi)
      ...
      #end def

      A inherited template:
      #from basetemplate import basetemplate
      #extends basetemplate
      #def viewdef(c, dburi)
      $basetemplate.viewdef(c, dburi)
      GRANT SELECT ON $c.viewname TO ofmt;
      #end def

      WITHOUT the C NameMapper, the inherited template works just fine.
      WITH the C NameMapper, I get an error:
      TypeError: unbound method viewdef() must be called with
      templatehelpers instance as first argument (got Config instance
      instead)

      Changing the call to basetemplate.viewdef to
      $basetemplate.viewdef(self, c, dburi),

      I get the opposite result:
      WITH the C NameMapper, the inherited template works just fine.
      WITHOUT the C NameMapper, I get an error:
      TypeError: viewdef() takes exactly 3 arguments (4 given)

      So it looks like the pure python and C namemappers are different. To
      me it looks as if the call to a supertemplate/superclass method SHOULD
      pass the self parameter, so the C version is the correct one.

      --
      Bernt

      -------------------------------------------------------------------------
      This SF.net email is sponsored by: Microsoft
      Defy all challenges. Microsoft(R) Visual Studio 2008.
      http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
      _______________________________________________
      Cheetahtemplate-discuss mailing list
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    • Franz Glasner
      Calling the baseclass implementation is what #super is for. Have You tried using #super? Franz. Bernt Røskar Brenna Sent by:
      Message 2 of 2 , May 30, 2008
      • 0 Attachment
        Calling the baseclass implementation is what #super is for.

        Have You tried using #super?

        Franz.






        "Bernt Røskar Brenna" <bernt.brenna@...>
        Sent by: cheetahtemplate-discuss-bounces@...
        30.05.2008 08:36

        To: cheetahtemplate-discuss@...
        cc:
        Subject: [Cheetahtemplate-discuss] Bug?: Difference between
        python and C NameMapper


        The case:

        A base template (basetemplate.tmpl) with a method:

        #def viewdef(c, dburi)
        ...
        #end def

        A inherited template:
        #from basetemplate import basetemplate
        #extends basetemplate
        #def viewdef(c, dburi)
        $basetemplate.viewdef(c, dburi)
        GRANT SELECT ON $c.viewname TO ofmt;
        #end def

        WITHOUT the C NameMapper, the inherited template works just fine.
        WITH the C NameMapper, I get an error:
        TypeError: unbound method viewdef() must be called with
        templatehelpers instance as first argument (got Config instance
        instead)

        Changing the call to basetemplate.viewdef to
        $basetemplate.viewdef(self, c, dburi),

        I get the opposite result:
        WITH the C NameMapper, the inherited template works just fine.
        WITHOUT the C NameMapper, I get an error:
        TypeError: viewdef() takes exactly 3 arguments (4 given)

        So it looks like the pure python and C namemappers are different. To
        me it looks as if the call to a supertemplate/superclass method SHOULD
        pass the self parameter, so the C version is the correct one.

        --
        Bernt

        -------------------------------------------------------------------------
        This SF.net email is sponsored by: Microsoft
        Defy all challenges. Microsoft(R) Visual Studio 2008.
        http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
        _______________________________________________
        Cheetahtemplate-discuss mailing list
        Cheetahtemplate-discuss@...
        https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss



        -------------------------------------------------------------------------
        This SF.net email is sponsored by: Microsoft
        Defy all challenges. Microsoft(R) Visual Studio 2008.
        http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
        _______________________________________________
        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.