Apply zope transaction to global Tailbone Session class.
This commit is contained in:
		
							parent
							
								
									d6f2b1afb1
								
							
						
					
					
						commit
						67f8960655
					
				
					 1 changed files with 10 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -29,7 +29,14 @@ Database Stuff
 | 
			
		|||
from sqlalchemy.orm import sessionmaker, scoped_session
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
__all__ = ['Session']
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Session = scoped_session(sessionmaker())
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
try:
 | 
			
		||||
    # Requires zope.sqlalchemy >= 0.7.4
 | 
			
		||||
    from zope.sqlalchemy import register
 | 
			
		||||
except ImportError:
 | 
			
		||||
    from zope.sqlalchemy import ZopeTransactionExtension
 | 
			
		||||
    Session.configure(extension=ZopeTransactionExtension())
 | 
			
		||||
else:
 | 
			
		||||
    register(Session)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue