Set the model attr when making new AppHandler object
				
					
				
			or at least try, and ignore errors, which will likely happen if e.g. the DB layer is not installed
This commit is contained in:
		
							parent
							
								
									bc3b9ea2f8
								
							
						
					
					
						commit
						611489fe59
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		|  | @ -66,6 +66,12 @@ class AppHandler(object): | |||
|     def __init__(self, config): | ||||
|         self.config = config | ||||
| 
 | ||||
|         # app may not use the db layer, but if so we set the model | ||||
|         try: | ||||
|             self.model = config.get_model() | ||||
|         except: | ||||
|             pass | ||||
| 
 | ||||
|     def get_title(self, default=None): | ||||
|         return self.config.app_title(default=default) | ||||
| 
 | ||||
|  | @ -79,7 +85,7 @@ class AppHandler(object): | |||
|         """ | ||||
|         import sqlalchemy as sa | ||||
| 
 | ||||
|         model = self.config.get_model() | ||||
|         model = self.model | ||||
|         return session.query(model.Store)\ | ||||
|                       .filter(sa.or_( | ||||
|                           model.Store.archived == False, | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar