Comment 7 for bug 129715

Revision history for this message
Drew Smathers (djfroofy) wrote :

Yes ... I forgot my original motivation for deferring the import. I've dug my old instance and retested - and indeed it does not fail will imported at the module level. My motivation was simply from a comment in the source code of _transaction which scared me:

# Sigh. In the maze of __init__.py's, ZODB.__init__.py takes 'get'
# out of transaction.__init__.py, in order to stuff the 'get_transaction'
# alias in __builtin__. So here in _transaction.py, we can't import
# exceptions from ZODB.POSException at top level (we're imported by
# our __init__.py, which is imported by ZODB's __init__, so the ZODB
# package isn't well-formed when we're first imported).
# from ZODB.POSException import TransactionError, TransactionFailedError

But yes, storm is outside of the nasty cycle - so it should be safe to just import ZODB.POSException at the module level. At the time I was just scared that there might be some zope magic going on (like deferredImport) and didn't pursue it further.