SQLObject uses assert for parameter checks
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
SQLObject uses some assert statements to make sure the
classes were given correct parameters or called correctly.
For example, in dbconnection.py
def uri(self):
auth = getattr(self, 'user', None) or ''
if auth:
if self.password:
auth = auth + '@' + self.password
auth = auth + ':'
else:
>>> assert not getattr(self, 'password',
None), (
>>> 'URIs cannot express passwords
without usernames')
or
assert not self._obsolete, "This transaction has
already gone through ROLLBACK; begin another transaction"
The problem with these constructs is that if SQLObject
is compiled with -O (which, for example Debian does),
asserts are removed!
So I can import sqlobject and happily pass incorrect
values, it will not be noticed.