Add constant RESPONSE_TYPES for use in isinstance checks.
This commit is contained in:
		
							parent
							
								
									049d620789
								
							
						
					
					
						commit
						2ba4a3bb91
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		|  | @ -10,6 +10,7 @@ import etiquette | ||||||
| 
 | 
 | ||||||
| SESSION_MAX_AGE = 86400 | SESSION_MAX_AGE = 86400 | ||||||
| REQUEST_TYPES = (flask.Request, werkzeug.wrappers.Request, werkzeug.local.LocalProxy) | REQUEST_TYPES = (flask.Request, werkzeug.wrappers.Request, werkzeug.local.LocalProxy) | ||||||
|  | RESPONSE_TYPES = (flask.Response, werkzeug.wrappers.Response) | ||||||
| 
 | 
 | ||||||
| def _generate_token(length=32): | def _generate_token(length=32): | ||||||
|     return etiquette.helpers.random_hex(length=length) |     return etiquette.helpers.random_hex(length=length) | ||||||
|  | @ -81,7 +82,7 @@ class SessionManager: | ||||||
|                 session.maintain() |                 session.maintain() | ||||||
| 
 | 
 | ||||||
|             response = function(*args, **kwargs) |             response = function(*args, **kwargs) | ||||||
|             if not isinstance(response, (flask.Response, werkzeug.wrappers.Response)): |             if not isinstance(response, RESPONSE_TYPES): | ||||||
|                 response = flask.Response(response) |                 response = flask.Response(response) | ||||||
| 
 | 
 | ||||||
|             # Send the token back to the client |             # Send the token back to the client | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue