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

[Cheetahtemplate-discuss] Re: Assertion error

Expand Messages
  • elian@inbrief.net
    I apologise for sending out a message containing just the traceback shown below... I hit the send button accidentally. The reason for the traceback is to ask
    Message 1 of 4 , Oct 31, 2001
    • 0 Attachment
      I apologise for sending out a message containing just the traceback shown
      below... I hit the send button accidentally.

      The reason for the traceback is to ask about it. I created a test .tmpl
      file containing pure html, then compiled the template file to a .py file.
      When I try to instantiate the servlet by going to the URL
      ~/MyContext/test.py, I get the traceback shown below. I'm using Cheetah
      0.9.9a4, and the test suite runs to completion with no errors.

      ...Edmund.

      /usr/lib/cgi-bin/OneShot.cgi/MyContext/test.py

      Traceback (most recent call last):
      File "/opt/Webware/WebKit/Application.py", line 348, in dispatchRequest
      self.handleGoodURL(transaction)
      File "/opt/Webware/WebKit/Application.py", line 494, in handleGoodURL
      self.createServletInTransaction(transaction)
      File "/opt/Webware/WebKit/Application.py", line 894, in
      createServletInTransaction
      inst = self.getServlet(transaction,path,cache)
      File "/opt/Webware/WebKit/Application.py", line 821, in getServlet
      inst = factory.servletForTransaction(transaction)
      File "/opt/Webware/WebKit/ServletFactory.py", line 179, in
      servletForTransaction
      assert module.__dict__.has_key(name), 'Cannot find expected servlet
      class named %s in %s.' % (repr(name), repr(path))
      AssertionError: Cannot find expected servlet class named 'test' in
      '/home/elian/WebwareTest/MyContext/test.py'.






      _______________________________________________
      Cheetahtemplate-discuss mailing list
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    • elian@inbrief.net
      ... Here they are... ...Edmund. ========== test.tmpl ## FILE: test.tmpl ## test contents ==========
      Message 2 of 4 , Oct 31, 2001
      • 0 Attachment
        Tavis wrote:

        >>Can you post the contents of those 2 files: test.tmpl and test.py?<<

        Here they are...

        ...Edmund.


        ==========
        test.tmpl

        ## FILE: test.tmpl ##
        <html>
        <head><title>test</title></head>
        <body>
        contents
        </body>
        </html>

        ==========
        test.py

        #!/usr/bin/env python

        """
        Autogenerated by CHEETAH: The Python-Powered Template Engine
        CHEETAH VERSION: 0.9.9a4
        Generation time: Wed Oct 31 20:32:35 2001
        Source file: ./test.tmpl
        Source file last modified: Wed Oct 31 20:32:27 2001
        """

        __CHEETAH_genTime__ = 'Wed Oct 31 20:32:35 2001'
        __CHEETAH_src__ = './test.tmpl'
        __CHEETAH_version__ = '0.9.9a4'

        ##################################################
        ## DEPENDENCIES

        import sys
        import os
        import os.path
        from os.path import getmtime, exists
        import time
        import types
        from Cheetah.Template import Template
        from Cheetah.DummyTransaction import DummyTransaction
        from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList
        import Cheetah.Filters as Filters
        import Cheetah.ErrorCatchers as ErrorCatchers

        ##################################################
        ## MODULE CONSTANTS

        True = (1==1)
        False = (1==0)

        ##################################################
        ## CLASSES

        class GenTemplate(Template):
        """

        Autogenerated by CHEETAH: The Python-Powered Template Engine
        """

        ##################################################
        ## GENERATED METHODS


        def __init__(self, *args, **KWs):
        """

        """

        Template.__init__(self, *args, **KWs)
        self._filePath = './test.tmpl'
        self._fileMtime = 1004578347

        def respond(self,
        trans=None,
        dummyTrans=False,
        VFS=valueFromSearchList,
        VFN=valueForName,
        getmtime=getmtime,
        currentTime=time.time):


        """
        This is the main method generated by Cheetah
        """

        if not trans:
        trans = DummyTransaction()
        dummyTrans = True
        write = trans.response().write
        SL = self._searchList
        filter = self._currentFilter
        globalSetVars = self._globalSetVars

        ########################################
        ## START - generated method body

        if exists('./test.tmpl') and getmtime('./test.tmpl') > self._fileMtime:
        self.compile(file='./test.tmpl')
        write(self.respond(trans=trans))
        if dummyTrans:
        return trans.response().getvalue()
        else:
        return ""
        # FILE: test.tmpl ##
        write('''<html>
        <head><title>test</title></head>
        <body>
        contents
        </body>
        </html>
        ''')

        ########################################
        ## END - generated method body

        if dummyTrans:
        return trans.response().getvalue()
        else:
        return ""

        ##################################################
        ## GENERATED ATTRIBUTES


        __str__ = respond


        # CHEETAH was developed by Tavis Rudd, Chuck Esterbrook, Ian Bicking and Mike Orr;
        # with code, advice and input from many other volunteers.
        # For more information visit http://www.CheetahTemplate.org

        ##################################################
        ## if run from command line:
        if __name__ == '__main__':
        GenTemplate().runAsMainProgram()



        _______________________________________________
        Cheetahtemplate-discuss mailing list
        Cheetahtemplate-discuss@...
        https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
      • Tavis Rudd
        Found the problem, I forgot to finish something up when I fixed the bug that Ian posted about this week. It s fixed in the CVS version now. I ll release
        Message 3 of 4 , Oct 31, 2001
        • 0 Attachment
          Found the problem, I forgot to finish something up when I fixed the
          bug that Ian posted about this week. It's fixed in the CVS version
          now. I'll release 0.9.9a5 in a few minutes as this is fairly major.
          Tavis

          On Wednesday 31 October 2001 17:59, elian@... wrote:
          > Tavis wrote:
          > >>Can you post the contents of those 2 files: test.tmpl and
          > >> test.py?<<
          >
          > Here they are...
          >
          > ...Edmund.
          >
          >
          > ==========
          > test.tmpl
          >
          > ## FILE: test.tmpl ##
          > <html>
          > <head><title>test</title></head>
          > <body>
          > contents
          > </body>
          > </html>
          >
          > ==========
          > test.py
          >
          > #!/usr/bin/env python
          >
          > """
          > Autogenerated by CHEETAH: The Python-Powered Template Engine
          > CHEETAH VERSION: 0.9.9a4
          > Generation time: Wed Oct 31 20:32:35 2001
          > Source file: ./test.tmpl
          > Source file last modified: Wed Oct 31 20:32:27 2001
          > """
          >
          > __CHEETAH_genTime__ = 'Wed Oct 31 20:32:35 2001'
          > __CHEETAH_src__ = './test.tmpl'
          > __CHEETAH_version__ = '0.9.9a4'
          >
          > ##################################################
          > ## DEPENDENCIES
          >
          > import sys
          > import os
          > import os.path
          > from os.path import getmtime, exists
          > import time
          > import types
          > from Cheetah.Template import Template
          > from Cheetah.DummyTransaction import DummyTransaction
          > from Cheetah.NameMapper import NotFound, valueForName,
          > valueFromSearchList import Cheetah.Filters as Filters
          > import Cheetah.ErrorCatchers as ErrorCatchers
          >
          > ##################################################
          > ## MODULE CONSTANTS
          >
          > True = (1==1)
          > False = (1==0)
          >
          > ##################################################
          > ## CLASSES
          >
          > class GenTemplate(Template):
          > """
          >
          > Autogenerated by CHEETAH: The Python-Powered Template Engine
          > """
          >
          > ##################################################
          > ## GENERATED METHODS
          >
          >
          > def __init__(self, *args, **KWs):
          > """
          >
          > """
          >
          > Template.__init__(self, *args, **KWs)
          > self._filePath = './test.tmpl'
          > self._fileMtime = 1004578347
          >
          > def respond(self,
          > trans=None,
          > dummyTrans=False,
          > VFS=valueFromSearchList,
          > VFN=valueForName,
          > getmtime=getmtime,
          > currentTime=time.time):
          >
          >
          > """
          > This is the main method generated by Cheetah
          > """
          >
          > if not trans:
          > trans = DummyTransaction()
          > dummyTrans = True
          > write = trans.response().write
          > SL = self._searchList
          > filter = self._currentFilter
          > globalSetVars = self._globalSetVars
          >
          > ########################################
          > ## START - generated method body
          >
          > if exists('./test.tmpl') and getmtime('./test.tmpl') >
          > self._fileMtime: self.compile(file='./test.tmpl')
          > write(self.respond(trans=trans))
          > if dummyTrans:
          > return trans.response().getvalue()
          > else:
          > return ""
          > # FILE: test.tmpl ##
          > write('''<html>
          > <head><title>test</title></head>
          > <body>
          > contents
          > </body>
          > </html>
          > ''')
          >
          > ########################################
          > ## END - generated method body
          >
          > if dummyTrans:
          > return trans.response().getvalue()
          > else:
          > return ""
          >
          > ##################################################
          > ## GENERATED ATTRIBUTES
          >
          >
          > __str__ = respond
          >
          >
          > # CHEETAH was developed by Tavis Rudd, Chuck Esterbrook, Ian
          > Bicking and Mike Orr; # with code, advice and input from many other
          > volunteers.
          > # For more information visit http://www.CheetahTemplate.org
          >
          > ##################################################
          > ## if run from command line:
          > if __name__ == '__main__':
          > GenTemplate().runAsMainProgram()

          _______________________________________________
          Cheetahtemplate-discuss mailing list
          Cheetahtemplate-discuss@...
          https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
        • Mike Orr
          ... For the record, this was the problem. A Webware servlet module must contain a class with the same name as the module, and the class must be a (direct or
          Message 4 of 4 , Oct 31, 2001
          • 0 Attachment
            On Wed, Oct 31, 2001 at 08:59:31PM -0500, elian@... wrote:
            > class GenTemplate(Template):

            For the record, this was the problem. A Webware servlet module
            must contain a class with the same name as the module, and the
            class must be a (direct or indirect) subclass of HTTPServlet.
            Thus, your class should have been called 'test'.

            It sounds like Tavis fixed whatever it was that caused your problem,
            but it's worth keeping in mind in the future if you have trouble with
            Webware servlets.

            --
            -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
          Your message has been successfully submitted and would be delivered to recipients shortly.