[SQL-CVS] r1233 - SQLObject/trunk/sqlobject/manager
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <sub...@co...> - 2005-11-09 22:20:15
|
Author: test
Date: 2005-11-09 22:20:06 +0000 (Wed, 09 Nov 2005)
New Revision: 1233
Modified:
SQLObject/trunk/sqlobject/manager/command.py
Log:
Clean up configuration and make it use paste deploy's new configuration loader when available
Modified: SQLObject/trunk/sqlobject/manager/command.py
===================================================================
--- SQLObject/trunk/sqlobject/manager/command.py 2005-11-09 00:09:58 UTC (rev 1232)
+++ SQLObject/trunk/sqlobject/manager/command.py 2005-11-09 22:20:06 UTC (rev 1233)
@@ -6,13 +6,11 @@
import sys
import textwrap
import warnings
+import time
try:
- from paste import pyconfig
- from paste import CONFIG
-except ImportError, e:
- pyconfig = None
- CONFIG = {}
-import time
+ from paste.deploy import appconfig
+except ImportError:
+ appconfig = None
import sqlobject
from sqlobject import col
@@ -320,13 +318,15 @@
def config(self):
if not getattr(self.options, 'config_file', None):
return None
- if pyconfig and self.options.config_fn.endswith('.conf'):
- config = pyconfig.Config(with_default=True)
- config.load(self.options.config_file)
- CONFIG.push_process_config(config)
- return config
+ config_file = self.options.config_file
+ if appconfig:
+ if (not config_file.startswith('egg:')
+ and not config_file.startswith('config:')):
+ config_file = 'config:' + config_file
+ return appconfig(config_file,
+ relative_to=os.getcwd())
else:
- return self.ini_config(self.options.config_file)
+ return self.ini_config(config_file)
def ini_config(self, conf_fn):
conf_section = 'main'
|