[SQL-CVS] r796 - trunk/SQLObject/sqlobject/manager
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2005-05-22 19:32:11
|
Author: ianb Date: 2005-05-22 19:32:05 +0000 (Sun, 22 May 2005) New Revision: 796 Modified: trunk/SQLObject/sqlobject/manager/command.py Log: Give a proper error message when using -f and paste.pyconfig cannot be found Modified: trunk/SQLObject/sqlobject/manager/command.py =================================================================== --- trunk/SQLObject/sqlobject/manager/command.py 2005-05-20 23:21:26 UTC (rev 795) +++ trunk/SQLObject/sqlobject/manager/command.py 2005-05-22 19:32:05 UTC (rev 796) @@ -9,7 +9,7 @@ try: from paste import pyconfig from paste import CONFIG -except ImportError: +except ImportError, e: pyconfig = None CONFIG = {} import time @@ -131,11 +131,10 @@ help="The database connection URI", metavar='URI', dest='connection_uri') - if pyconfig: - parser.add_option('-f', '--config-file', - help="The Paste config file that contains the database URI (in the database key)", - metavar="FILE", - dest="config_file") + parser.add_option('-f', '--config-file', + help="The Paste config file that contains the database URI (in the database key)", + metavar="FILE", + dest="config_file") if find_modules: parser.add_option('-m', '--module', help="Module in which to find SQLObject classes", @@ -287,8 +286,10 @@ def config(self): if getattr(self.options, 'config_file', None): - assert pyconfig, ( - "The --config-file option should not be available without paste.pyconfig installed") + if not pyconfig: + print "You must have Python Paste installed (and on your $PYTHONPATH)" + print "to use the -f/--config-file option." + sys.exit(2) config = pyconfig.Config(with_default=True) config.load(self.options.config_file) CONFIG.push_process_config(config) |