[EMAIL PROTECTED] wrote:
i want to ask for http;//localhost:8080/Subdirectory from within a
template
in the templates directory, i have a directory names Subdirectory,
which contains an empty __init__.py file and a really simple index.kid
in controllers.py, i'm assuming that i do
class Subdirectory:
@turbogears.expose('project.templates.Subdirectory.index')
def index(self)
return dict()
but that by itself doesn't work. i saw reference to doing some
cherrypy stuff to tell it that when i ask for Subdirectory to hook it
together (cherrypy.root.Subdirectory = Subdirectory() ), that makes
sense, but it doesn't work, either.
Just creating a new Subdirectory for your templates won't get you what
you're wanting. You'll have to attach a new controller to your Root
controller. I don't know if this is the *right* way to do it, but this
is how I set mine up.
I have my Root controller in my controllers.py file. I have a
tg_store.py module (in the same directory with the controllers.py file)
which contains a Store controller. In the controllers.py module, I do:
from tg_store import Store
just to get it in the controller's namespace. Then, to attach that
Store controller to my Root controller, I do this (in controllers.py):
Root.store = Store()
I actually have all of Store's templates in the main templates
directory, so I can refer to them via
@turbogears.expose(html="project.templates.template_name") (or something
like that).
hth,
- jmj