Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #513 (closed defect: fixed)

Opened 13 years ago

Last modified 13 years ago

turbocheetah not automatically compiling and error on first use of compiled template

Reported by: anonymous Owned by: anonymous
Priority: normal Milestone: 0.9
Component: Kid Version:
Severity: normal Keywords:
Cc:

Description

Problem

Using new plugin format ( http://www.turbogears.org/docs/plugins/template.html), all plugins tested (turbokid, turbostan, turbohtmlpy) worked as expected with the exception of turbocheetah.

Environment

  • WinXP, Python 2.4.2
  • cherrypy-2.2.0beta-py2.4.egg
  • turbocheetah-0.9.3-py2.4.egg
  • cheetah-2.0rc2-py2.4.egg
  • TurboGears-0.9a0dev_r643-py2.4.egg

Error Walkthrough

First testing a template called "test_cheetah.tmpl" in "app.templates"

500 Internal error

The server encountered an unexpected condition which prevented it from fulfilling the request.

Page handler: <bound method Root.test_cheetah of <app.controllers.Root object at 0x012AD8B0>>
Traceback (most recent call last):
  File "c:\engines\python24\lib\site-packages\cherrypy-2.2.0beta-py2.4.egg\cherrypy\_cphttptools.py", line 98, in _run
    self.main()
  File "c:\engines\python24\lib\site-packages\cherrypy-2.2.0beta-py2.4.egg\cherrypy\_cphttptools.py", line 246, in main
    body = page_handler(*virtual_path, **self.params)
  File "<string>", line 3, in test_cheetah
  File "c:\engines\python24\lib\site-packages\TurboGears-0.9a0dev_r643-py2.4.egg\turbogears\controllers.py", line 218, in expose
    func, tg_format, html, fragment, *args, **kw)
  File "c:\engines\python24\lib\site-packages\TurboGears-0.9a0dev_r643-py2.4.egg\turbogears\database.py", line 193, in run_with_transaction
    retval = func(*args, **kw)
  File "c:\engines\python24\lib\site-packages\TurboGears-0.9a0dev_r643-py2.4.egg\turbogears\controllers.py", line 253, in _execute_func
    return _process_output(tg_format, output, html, fragment)
  File "c:\engines\python24\lib\site-packages\TurboGears-0.9a0dev_r643-py2.4.egg\turbogears\controllers.py", line 66, in _process_output
    fragment=fragment)
  File "c:\engines\python24\lib\site-packages\TurboGears-0.9a0dev_r643-py2.4.egg\turbogears\view.py", line 60, in render
    return engine.render(info, format, fragment, template)
  File "c:\engines\python24\lib\site-packages\turbocheetah-0.9.3-py2.4.egg\turbocheetah\cheetahsupport.py", line 68, in render
    tclass = self.load_template(template)
  File "c:\engines\python24\lib\site-packages\turbocheetah-0.9.3-py2.4.egg\turbocheetah\cheetahsupport.py", line 57, in load_template
    mod = __import__(classname, dict(), dict(), [basename])
ImportError: No module named test_cheetah

In this case the template "test_cheetah" did not compile and was not found.

After a manual compilation of the cheetah templates using "cheetah compile -R" and accessing the template again via turbogears, the following error:

500 Internal error

The server encountered an unexpected condition which prevented it from fulfilling the request.

Page handler: <bound method Root.test_cheetah of <app.controllers.Root object at 0x012E37D0>>
Traceback (most recent call last):
  File "c:\engines\python24\lib\site-packages\cherrypy-2.2.0beta-py2.4.egg\cherrypy\_cphttptools.py", line 98, in _run
    self.main()
  File "c:\engines\python24\lib\site-packages\cherrypy-2.2.0beta-py2.4.egg\cherrypy\_cphttptools.py", line 246, in main
    body = page_handler(*virtual_path, **self.params)
  File "<string>", line 3, in test_cheetah
  File "c:\engines\python24\lib\site-packages\TurboGears-0.9a0dev_r643-py2.4.egg\turbogears\controllers.py", line 218, in expose
    func, tg_format, html, fragment, *args, **kw)
  File "c:\engines\python24\lib\site-packages\TurboGears-0.9a0dev_r643-py2.4.egg\turbogears\database.py", line 193, in run_with_transaction
    retval = func(*args, **kw)
  File "c:\engines\python24\lib\site-packages\TurboGears-0.9a0dev_r643-py2.4.egg\turbogears\controllers.py", line 253, in _execute_func
    return _process_output(tg_format, output, html, fragment)
  File "c:\engines\python24\lib\site-packages\TurboGears-0.9a0dev_r643-py2.4.egg\turbogears\controllers.py", line 66, in _process_output
    fragment=fragment)
  File "c:\engines\python24\lib\site-packages\TurboGears-0.9a0dev_r643-py2.4.egg\turbogears\view.py", line 60, in render
    return engine.render(info, format, fragment, template)
  File "c:\engines\python24\lib\site-packages\turbocheetah-0.9.3-py2.4.egg\turbocheetah\cheetahsupport.py", line 68, in render
    tclass = self.load_template(template)
  File "c:\engines\python24\lib\site-packages\turbocheetah-0.9.3-py2.4.egg\turbocheetah\cheetahsupport.py", line 61, in load_template
    tfile, classname)
  File "c:\engines\python24\lib\site-packages\turbocheetah-0.9.3-py2.4.egg\turbocheetah\cheetahsupport.py", line 15, in _recompile_template
    tempclass = ns["GenTemplate"]
KeyError: 'GenTemplate'

Refreshing the browser immediately after this retrieves the correctly rendered page.

Change History

comment:1 Changed 13 years ago by anonymous

  • Component changed from CherryPy to TurboGears
  • Milestone set to 0.9

Corrected component & milestone reference.

comment:2 Changed 13 years ago by anonymous

  • Status changed from new to closed
  • Resolution set to invalid

can't duplicate this anymore so I suppose it was an aberration.

comment:3 Changed 13 years ago by anonymous

  • Status changed from closed to reopened
  • Resolution invalid deleted

Spoke too soon. Same problem applies to [TurboGears-0.9a0dev_r661-py2.4.egg] as well.

comment:4 Changed 13 years ago by anonymous

Forgot too post the traceback from the error:

500 Internal error

The server encountered an unexpected condition which prevented it from fulfilling the request.

Page handler: <bound method Root.test_kid of <gspace.controllers.Root object at 0x0109CA50>>
Traceback (most recent call last):
  File "c:\engines\python24\lib\site-packages\cherrypy-2.2.0beta-py2.4.egg\cherrypy\_cphttptools.py", line 99, in _run
    self.main()
  File "c:\engines\python24\lib\site-packages\cherrypy-2.2.0beta-py2.4.egg\cherrypy\_cphttptools.py", line 247, in main
    body = page_handler(*virtual_path, **self.params)
  File "<string>", line 3, in test_kid
  File "c:\engines\python24\lib\site-packages\TurboGears-0.9a0dev_r661-py2.4.egg\turbogears\controllers.py", line 184, in expose
    func, tg_format, html, fragment, *args, **kw)
  File "c:\engines\python24\lib\site-packages\TurboGears-0.9a0dev_r661-py2.4.egg\turbogears\database.py", line 193, in run_with_transaction
    retval = func(*args, **kw)
  File "c:\engines\python24\lib\site-packages\TurboGears-0.9a0dev_r661-py2.4.egg\turbogears\controllers.py", line 201, in _execute_func
    return _process_output(tg_format, output, html, fragment)
  File "c:\engines\python24\lib\site-packages\TurboGears-0.9a0dev_r661-py2.4.egg\turbogears\controllers.py", line 64, in _process_output
    fragment=fragment)
  File "c:\engines\python24\lib\site-packages\TurboGears-0.9a0dev_r661-py2.4.egg\turbogears\view.py", line 60, in render
    return engine.render(info, format, fragment, template)
  File "c:\engines\python24\lib\site-packages\turbokid-0.9.0-py2.4.egg\turbokid\kidsupport.py", line 122, in render
    tclass = self.load_template(template)
  File "c:\engines\python24\lib\site-packages\turbokid-0.9.0-py2.4.egg\turbokid\kidsupport.py", line 96, in load_template
    mod = _freshen_template(package, basename, tfile, classname)
  File "c:\engines\python24\lib\site-packages\turbokid-0.9.0-py2.4.egg\turbokid\kidsupport.py", line 41, in _freshen_template
    saved_mtime = sys.modules[classname].__mtime__
AttributeError: 'module' object has no attribute '__mtime__'

comment:5 Changed 13 years ago by anonymous

  • Component changed from TurboGears to Kid

assigned to proper component (kid)

comment:6 Changed 13 years ago by anonymous

  • Status changed from reopened to closed
  • Resolution set to fixed

Should reopen under different ticket.

Note: See TracTickets for help on using tickets.