Revision 2484
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
36 | 36 |
|
37 | 37 |
class ExceptionWithName(DbException): |
38 | 38 |
def __init__(self, name, cause=None): |
39 |
DbException.__init__(self, 'for name: '+str(name), cause)
|
|
39 |
DbException.__init__(self, 'for name: '+strings.as_tt(str(name)), cause)
|
|
40 | 40 |
self.name = name |
41 | 41 |
|
42 | 42 |
class ExceptionWithNameValue(DbException): |
43 | 43 |
def __init__(self, name, value, cause=None): |
44 |
DbException.__init__(self, |
|
45 |
'for name: '+str(name)+'; value: '+repr(value), cause)
|
|
44 |
DbException.__init__(self, 'for name: '+strings.as_tt(str(name))
|
|
45 |
+'; value: '+strings.as_tt(repr(value)), cause)
|
|
46 | 46 |
self.name = name |
47 | 47 |
self.value = value |
48 | 48 |
|
49 | 49 |
class ConstraintException(DbException): |
50 | 50 |
def __init__(self, name, cols, cause=None): |
51 |
DbException.__init__(self, 'Violated '+name+ ' constraint on columns: '
|
|
52 |
+(', '.join(cols)), cause) |
|
51 |
DbException.__init__(self, 'Violated '+strings.as_tt(name)
|
|
52 |
+' constraint on columns: '+strings.as_tt(', '.join(cols)), cause)
|
|
53 | 53 |
self.name = name |
54 | 54 |
self.cols = cols |
55 | 55 |
|
Also available in: Unified diff
sql.py: Parsed exceptions: Use strings.as_tt() to format Python values