sources/oauth: split up single large "core" views
This commit is contained in:
		
							
								
								
									
										19
									
								
								passbook/sources/oauth/views/base.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								passbook/sources/oauth/views/base.py
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| """OAuth Base views""" | ||||
| from typing import Callable, Optional | ||||
|  | ||||
| from passbook.sources.oauth.clients import BaseOAuthClient, get_client | ||||
| from passbook.sources.oauth.models import OAuthSource | ||||
|  | ||||
|  | ||||
| # pylint: disable=too-few-public-methods | ||||
| class OAuthClientMixin: | ||||
|     "Mixin for getting OAuth client for a source." | ||||
|  | ||||
|     client_class: Optional[Callable] = None | ||||
|  | ||||
|     def get_client(self, source: OAuthSource) -> BaseOAuthClient: | ||||
|         "Get instance of the OAuth client for this source." | ||||
|         if self.client_class is not None: | ||||
|             # pylint: disable=not-callable | ||||
|             return self.client_class(source) | ||||
|         return get_client(source) | ||||
		Reference in New Issue
	
	Block a user
	 Jens Langhammer
					Jens Langhammer