[Checkins] SVN: zope.paste/trunk/zope/paste/factory.py Treat relative filenames as relative to the PasteDeploy config file

Philipp von Weitershausen philikon at philikon.de
Thu Mar 29 18:56:25 EDT 2007


Log message for revision 73933:
  Treat relative filenames as relative to the PasteDeploy config file
  

Changed:
  U   zope.paste/trunk/zope/paste/factory.py

-=-
Modified: zope.paste/trunk/zope/paste/factory.py
===================================================================
--- zope.paste/trunk/zope/paste/factory.py	2007-03-29 22:49:30 UTC (rev 73932)
+++ zope.paste/trunk/zope/paste/factory.py	2007-03-29 22:56:25 UTC (rev 73933)
@@ -7,11 +7,18 @@
 
 def zope_app_factory(global_conf, site_definition, file_storage=None,
                      db_definition=None, devmode='no'):
+    # relative filenames are understood to be relative to the
+    # PasteDeploy configuration file
+    def abspath(path):
+        if os.path.isabs(path):
+            return path
+        return os.path.join(global_conf['here'], path)
+
     # load ZCML (usually site.zcml)
     features = ()
     if devmode.lower() in ('yes', 'true', 'on'):
         features += ('devmode',)
-    zope.app.appsetup.config(site_definition, features)
+    zope.app.appsetup.config(abspath(site_definition), features)
 
     if file_storage is None and db_definition is None:
         raise TypeError("You must either provide a 'file_storage' or a "
@@ -23,11 +30,12 @@
 
     # open database
     if file_storage is not None:
-        db = zope.app.appsetup.database(file_storage)
+        db = zope.app.appsetup.database(abspath(file_storage))
     else:
         schema_xml = os.path.join(os.path.dirname(__file__), 'schema.xml')
         schema = ZConfig.loadSchema(schema_xml)
-        cfgroot, cfghandlers = ZConfig.loadConfig(schema, db_definition)
+        cfgroot, cfghandlers = ZConfig.loadConfig(
+            schema, abspath(db_definition))
 
         result, databases = multi_database(cfgroot.databases)
         db = result[0]



More information about the Checkins mailing list