[Zope3-checkins] CVS: Zope3/src/zope/app/rdb - __init__.py:1.12
Steve Alexander
steve@cat-box.net
Mon, 9 Jun 2003 10:59:05 -0400
Update of /cvs-repository/Zope3/src/zope/app/rdb
In directory cvs.zope.org:/tmp/cvs-serv28637/src/zope/app/rdb
Modified Files:
__init__.py
Log Message:
Converted asserts into tests and ValueErrors.
So doing, removed an XXX comment.
=== Zope3/src/zope/app/rdb/__init__.py 1.11 => 1.12 ===
--- Zope3/src/zope/app/rdb/__init__.py:1.11 Sat Jun 7 16:10:02 2003
+++ Zope3/src/zope/app/rdb/__init__.py Mon Jun 9 10:58:34 2003
@@ -171,9 +171,11 @@
dbname database name
parameters a mapping of additional parameters to their values
"""
- # XXX these should not be assertions
- assert isinstance(dsn, StringTypes), 'The dsn is not a string.'
- assert dsn.startswith('dbi://'), 'Invalid DSN; must start with "dbi://"'
+ if not isinstance(dsn, StringTypes):
+ raise ValueError('The dsn is not a string. It is a %s'
+ % repr(type(dsn)))
+ if not dsn.startswith('dbi://'):
+ raise ValueError('Invalid DSN; must start with "dbi://": %s' % dsn)
result = {}