Commits

Robert Brewer  committed 68f2e61

Fix for #881 (Support specifying multiple imports/function calls via PythonOption cherrypy.setup instead of just one.).

  • Participants
  • Parent commits 24e2267

Comments (0)

Files changed (1)

File cherrypy/_cpmodpy.py

 def setup(req):
     from mod_python import apache
     
-    # Run any setup function defined by a "PythonOption cherrypy.setup" directive.
+    # Run any setup functions defined by a "PythonOption cherrypy.setup" directive.
     options = req.get_options()
     if 'cherrypy.setup' in options:
-        atoms = options['cherrypy.setup'].split('::', 1)
-        if len(atoms) == 1:
-            mod = __import__(atoms[0], globals(), locals())
-        else:
-            modname, fname = atoms
-            mod = __import__(modname, globals(), locals(), [fname])
-            func = getattr(mod, fname)
-            func()
+        for function in options['cherrypy.setup'].split():
+            atoms = options['cherrypy.setup'].split('::', 1)
+            if len(atoms) == 1:
+                mod = __import__(atoms[0], globals(), locals())
+            else:
+                modname, fname = atoms
+                mod = __import__(modname, globals(), locals(), [fname])
+                func = getattr(mod, fname)
+                func()
     
     cherrypy.config.update({'log.screen': False,
                             "tools.ignore_headers.on": True,