262
261
clear_property_cache(self)
265
class ZopelessTransactionManager(object):
266
"""Compatibility shim for initZopeless()"""
271
raise AssertionError("ZopelessTransactionManager should not be "
272
"directly instantiated.")
275
def initZopeless(cls, dbuser=None, isolation=ISOLATION_LEVEL_DEFAULT):
277
raise AssertionError(
278
"dbuser is now required. All scripts must connect as unique "
282
ISOLATION_LEVEL_AUTOCOMMIT: 'autocommit',
283
ISOLATION_LEVEL_READ_COMMITTED: 'read_committed',
284
ISOLATION_LEVEL_SERIALIZABLE: 'serializable'}[isolation]
286
dbconfig.override(dbuser=dbuser, isolation_level=isolation_level)
289
cls._isolation = isolation
295
"""Reset the active stores.
297
This is required for connection setting changes to be made visible.
299
for name, store in getUtility(IZStorm).iterstores():
300
connection = store._connection
301
if connection._state == storm.database.STATE_CONNECTED:
302
if connection._raw_connection is not None:
303
connection._raw_connection.close()
305
# This method assumes that calling transaction.abort() will
306
# call rollback() on the store, but this is no longer the
307
# case as of jamesh's fix for bug 230977; Stores are not
308
# registered with the transaction manager until they are
309
# used. While storm doesn't provide an API which does what
310
# we want, we'll go under the covers and emit the
311
# register-transaction event ourselves. This method is
312
# only called by the test suite to kill the existing
313
# connections so the Store's reconnect with updated
314
# connection settings.
315
store._event.emit('register-transaction')
317
connection._raw_connection = None
318
connection._state = storm.database.STATE_DISCONNECTED
323
"""Uninstall the ZopelessTransactionManager.
325
This entails removing the config overlay and resetting the store.
327
assert cls._installed is not None, (
328
"ZopelessTransactionManager not installed")
329
dbconfig.override(dbuser=None, isolation_level=None)
331
cls._installed = None
334
264
def clear_current_connection_cache():
335
265
"""Clear SQLObject's object cache. SQLObject compatibility - DEPRECATED.