Hey Turbogears people,
I have a question about organizing kid templates in folders. To keep my
templates folder organized I want to divide them into subdirectories of the
templates folder.
I have the following files in my templates dir:
errors/
errors/e404.kid
errors/__init__.pyc
errors/__init__.py
errors/master.pyc
errors/e404.pyc
errors/master.kid
__init__.py
__init__.pyc
login.kid
master.kid
master.pyc
project_edit.kid
project_edit.pyc
project_list.kid
project_list.pyc
project_show.kid
project_show.pyc
The ErrorController exposes the e404 method with the errors/e404.kid
template (code below). When I visit /error/e404 I get the error
"AttributeError: 'module' object has no attribute 'Template'" error. I have
no idea of how to solve this. I guess it is something simple, but I can't
find any docs on organizing kid templates into folders. The full traceback
of the error is below, as are the errors/master.kid and errors/e404.kid
templates.
I hope somebody can help me.
Thanks,
Dolf.
error controller:
class ErrorController(controllers.Controller):
@expose(template="pyredman.templates.errors.e404")
def e404(self,page):
return dict(code="404",message="%s could not be found"%page)
traceback:
Page handler: <bound method ErrorController.e404 of <
pyredman.controllers.ErrorController object at 0x862d4ac>>
Traceback (most recent call last):
File "/var/lib/python-support/python2.4/cherrypy/_cphttptools.py", line
105, in _run
self.main()
File "/var/lib/python-support/python2.4/cherrypy/_cphttptools.py", line
254, in main
body = page_handler(*virtual_path, **self.params)
File "<string>", line 3, in e404
File "/var/lib/python-support/python2.4/turbogears/controllers.py", line
342, in expose
output = database.run_with_transaction(
File "<string>", line 5, in run_with_transaction
File "/var/lib/python-support/python2.4/turbogears/database.py", line 406,
in sa_rwt
retval = func(*args, **kw)
File "<string>", line 5, in _expose
File "/var/lib/python-support/python2.4/turbogears/controllers.py", line
359, in <lambda>
mapping, fragment, args, kw)))
File "/var/lib/python-support/python2.4/turbogears/controllers.py", line
399, in _execute_func
return _process_output(output, template, format, content_type, mapping,
fragment)
File "/var/lib/python-support/python2.4/turbogears/controllers.py", line
86, in _process_output
fragment=fragment)
File "/var/lib/python-support/python2.4/turbogears/view/base.py", line
129, in render
return engine.render(**kw)
File "/var/lib/python-support/python2.4/turbokid/kidsupport.py", line 168,
in render
tclass = self.load_template(template)
File "/var/lib/python-support/python2.4/turbokid/kidsupport.py", line 99,
in load_template
tclass = sys.modules[classname].Template
AttributeError: 'module' object has no attribute 'Template'
errors/master.kid:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?python import sitetemplate ?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
py:extends="sitetemplate">
<head py:match="item.tag=='{http://www.w3.org/1999/xhtml}head'" py:attrs="
item.items()">
<meta content="text/html; charset=UTF-8" http-equiv="content-type"
py:replace="''"/>
<title py:replace="''">Your title goes here</title>
<meta py:replace="item[:]"/>
<style type="text/css">
#pageLogin
{
font-size: 10px;
font-family: verdana;
text-align: right;
}
</style>
<style type="text/css" media="screen">
@import "${tg.url('/static/css/style.css')}";
</style>
</head>
<body py:match="item.tag=='{http://www.w3.org/1999/xhtml}body'" py:attrs="
item.items()">
<div id="header"> </div>
<div id="main_content">
<div py:replace="[item.text]+item[:]"/>
<!-- main content -->
</div>
<div id="footer"></div>
</div>
</body>
</html>
errors/e404.kid:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#
"
py:extends="'master.kid'">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"
py:replace="''"/>
<title>PyRedMan - Create/Edit</title>
</head>
<body>
<h1 class="error_code">Error <span py:replace="code">Error code</span> -
<span py:replace="message"></span></h1>
</body>
</html>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---