[SQL-CVS] r1031 - SQLObject/trunk/sqlobject/manager
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <sub...@co...> - 2005-09-25 01:38:06
|
Author: ianb
Date: 2005-09-25 01:38:00 +0000 (Sun, 25 Sep 2005)
New Revision: 1031
Modified:
SQLObject/trunk/sqlobject/manager/command.py
Log:
Read .ini configuration files that use %(here)s and other variable substitution
Modified: SQLObject/trunk/sqlobject/manager/command.py
===================================================================
--- SQLObject/trunk/sqlobject/manager/command.py 2005-09-24 21:03:15 UTC (rev 1030)
+++ SQLObject/trunk/sqlobject/manager/command.py 2005-09-25 01:38:00 UTC (rev 1031)
@@ -333,8 +333,8 @@
if '#' in conf_fn:
conf_fn, conf_section = conf_fn.split('#', 1)
- from ConfigParser import RawConfigParser
- p = RawConfigParser()
+ from ConfigParser import ConfigParser
+ p = ConfigParser()
# Case-sensitive:
p.optionxform = str
if not os.path.exists(conf_fn):
@@ -343,11 +343,15 @@
raise OSError(
"Config file %s does not exist" % self.options.config_file)
p.read([conf_fn])
+ p._defaults.setdefault(
+ 'here', os.path.dirname(os.path.abspath(conf_fn)))
possible_sections = []
for section in p.sections():
name = section.strip().lower()
- if conf_section == name or conf_section == name.split(':')[-1]:
+ if (conf_section == name or
+ (conf_section == name.split(':')[-1]
+ and name.split(':')[0] in ('app', 'application'))):
possible_sections.append(section)
if not possible_sections:
|