[Grok-dev] grokproject: paster support in trunk now
Brandon Craig Rhodes
brandon at rhodesmill.org
Sat Dec 13 17:37:09 EST 2008
[Derek's co-worker attempted to post here to grok-dev, but said the
message never made it through to the list; so I'm re-posting their
reply here for them; this is from "Luong, Kim" <kim.luong at oit.gatech.edu>:]
------------------------------------------------------------------------
Hi, I'm working with Derek. We tried to use the change and have two
different grok applications running in the same paste ini file. To do
this we had to change startup.py to look for zope_conf in the local
config before the global config. While there, we also added a hard coded
fall back to the template so if zope_conf is not defined in either the
local or global config, it looks for it in the etc directory of the
directory grokproject created. The patch for this is below.
However, our paste pipeline is currently directing requests to the URLs
/tco and /invoice, which are each mapped to a different grok application
, to only one of the grok applications. In other words, /tco should go
to the tco application and /invoice should go to the invoice
application; currently, we seeing both /tco and /invoice going to the
tco application, which is the first of the two applications defined in
our paster ini.
Do you expect that this is a problem with our paste pipeline? Or can we
not run multiple grok instances in a single paste pipeline? If the
second, we think it is valuable to have this capability before grok 1.0
beta 1 because we know of no way to map (in a paste ini file) arbitrary
URLs to different grok applications running in a single grok
instance. Of course, if this is possible, we'd be happy to simply know
how. :)
Kim (diff below)
Index: startup.py_tmpl
===================================================================
--- startup.py_tmpl (revision 93857)
+++ startup.py_tmpl (working copy)
@@ -5,8 +5,9 @@
import zope.app.wsgi
import zope.app.debug
-def application_factory(global_conf):
- zope_conf = os.path.join(global_conf['zope_conf'])
+def application_factory(global_conf, **local_conf):
+ conf_name = local_conf.get('zope_conf', global_conf.get('zope.conf', '${package_directory}/etc/zope.conf')
+ zope_conf = os.path.join(conf_name)
return zope.app.wsgi.getWSGIApplication(zope_conf)
def interactive_debug_prompt(zope_conf='${package_directory}/etc/zope.conf'):
@@ -32,4 +33,4 @@
def zdaemon_controller(zdaemon_conf='${package_directory}/etc/zdaemon.conf'):
args = ['-C', zdaemon_conf] + sys.argv[1:]
- zdaemon.zdctl.main(args, options=None, cmdclass=ControllerCommands)
\ No newline at end of file
+ zdaemon.zdctl.main(args, options=None, cmdclass=ControllerCommands)
------------------------------------------------------------------------
--
Brandon Craig Rhodes brandon at rhodesmill.org http://rhodesmill.org/brandon
More information about the Grok-dev
mailing list