validate the db, since it can be an Instance of two different types
(self, change)
| 187 | db = Any() |
| 188 | @observe('db') |
| 189 | def _db_changed(self, change): |
| 190 | """validate the db, since it can be an Instance of two different types""" |
| 191 | new = change['new'] |
| 192 | connection_types = (DummyDB,) |
| 193 | if sqlite3 is not None: |
| 194 | connection_types = (DummyDB, sqlite3.Connection) |
| 195 | if not isinstance(new, connection_types): |
| 196 | msg = "%s.db must be sqlite3 Connection or DummyDB, not %r" % \ |
| 197 | (self.__class__.__name__, new) |
| 198 | raise TraitError(msg) |
| 199 | |
| 200 | def __init__(self, profile='default', hist_file=u'', **traits): |
| 201 | """Create a new history accessor. |
nothing calls this directly
no outgoing calls
no test coverage detected