I ended up with this:
------------
import pkg_resources
pkg_resources.require("TurboGears")

import cherrypy
import turbogears

turbogears.update_config(
    configfile = r"D:\OZ\Projects\ccleads\dev_apache.cfg",
    modulename = "ccleads.config.app")

from ccleads.controllers import Root

#cherrypy.root = Root()
cherrypy.tree.mount(Root(), turbogears.config.get('server.mount_point',
None))
cherrypy.server.start(initOnly=True, serverClass=None)

def fixuphandler(req):
    return 0
------------

I have server.mount_point="/ccleads" inside my dev.cfg config file.

Now I have the following issues:

1. All my links inside web files (kid, js, css) have to take this new
mount point into account. This is not hard to do for kid files. I have
to use tg.url(). Certanly I loose some of the cimplicity and ease of
design (Dreamweaver can nicely show images when you use
/static/images/img.gif syntax, but not when you use tg.url()) but I'm
still able to make it work. Bigger problem is with JS and CSS files
where I can't use tg.url().

Currently the site looks just nice (styled) but only because there is
/static directory served by Apache directly from my ccleads/static
folder. This makes me wonder how to separate static content from
multiple sites and not just controllers? I think I know kow to make
apache Alias but I'm not sure how to design my CSS and JS files.

My next issues are with Identity:

2. I had to comment out all identity code from my templates because of
this:

  File "d:\oz\projects\ccleads\ccleads\templates\master.py", line 147,
in _match_func
    yield (START, current)
  File
"c:\python24\lib\site-packages\TurboGears-0.9a2-py2.4.egg\turbogears\identity\__init__.py",
line 50, in __getattr__
    identity= self.identity()
  File
"c:\python24\lib\site-packages\TurboGears-0.9a2-py2.4.egg\turbogears\identity\__init__.py",
line 43, in identity
    raise IdentityManagementNotEnabledException()
IdentityManagementNotEnabledException: An attempt was made to use a
facility of the TurboGears Identity Management framework but identity
management hasn't been enabled in the config file [via identity.on].

As you can guess, this works if I mount my app to server root.

I also had to comment out all @identity.require decorators because of
the same issue, only this time without a traceback but with "login"
page which says (An attempt was made to use a facility of the
TurboGears Identity Management framework but identity management hasn't
been enabled in the config file [via identity.on].) This message comes
from cherrypy.request.identity_errors which I display on login page.

3. I had to change app.cfg configuration and say:

   identity.failure_url="/ccleads/login"

to make login page appear. Now, app.cfg should not be modified during
deployment so it is my guess that Identity doesn't do a right thing
with this key. I tried to change the line which uses that url:

identity/exceptions.py:
-  cherrypy.InternalRedirect.__init__(self, url)
+  cherrypy.InternalRedirect.__init__(self, turbogears.url(url))

but it didn't help. I guess it has to do with InternalRedirect (usually
I use HTTPRedirect which works).


Tvrtko Sokolovski


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to