[SQL-CVS] r990 - SQLObject/trunk/sqlobject/manager
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <sub...@co...> - 2005-09-15 23:14:38
|
Author: test
Date: 2005-09-15 23:14:33 +0000 (Thu, 15 Sep 2005)
New Revision: 990
Modified:
SQLObject/trunk/sqlobject/manager/command.py
Log:
Better error message
Modified: SQLObject/trunk/sqlobject/manager/command.py
===================================================================
--- SQLObject/trunk/sqlobject/manager/command.py 2005-09-13 20:22:39 UTC (rev 989)
+++ SQLObject/trunk/sqlobject/manager/command.py 2005-09-15 23:14:33 UTC (rev 990)
@@ -220,7 +220,8 @@
update_sys_path(conf['sys_path'], self.options.verbose)
self.command()
- def classes(self, require_connection=True):
+ def classes(self, require_connection=True,
+ require_some=False):
all = []
conf = self.config()
if conf and conf.get('database_module'):
@@ -260,6 +261,19 @@
'You must indicate --connection=URI'
% '\n * '.join([soClass.__name__
for soClass in missing]))
+ if require_some and not all:
+ print 'No classes found!'
+ if self.options.modules:
+ print 'Looked in modules: %s' % ', '.join(self.options.modules)
+ else:
+ print 'No modules specified'
+ if self.options.packages:
+ print 'Looked in packages: %s' % ', '.join(self.options.packages)
+ else:
+ print 'No packages specified'
+ if self.options.class_matchers:
+ print 'Matching class pattern: %s' % self.options.class_matches
+ sys.exit(1)
return all
def classes_from_module(self, module):
@@ -440,7 +454,7 @@
created = 0
existing = 0
dbs_created = []
- for soClass in self.classes():
+ for soClass in self.classes(require_some=True):
if (self.options.create_db
and soClass._connection not in dbs_created):
soClass._connection.createEmptyDatabase()
|