Created
October 27, 2018 16:17
-
-
Save I159/987ab76b4d43d4fb0679d240fb369c6e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Framework Code: | |
class TokenInterface(): | |
def getUserFromToken(self, token): | |
raise NotImplementedError | |
class FrameworkClass(TokenInterface): | |
def do_the_job(self, ...): | |
# some stuff | |
self.user = super().getUserFromToken(...) | |
#Client Code: | |
class SQLUserFromToken(TokenInterface): | |
def getUserFromToken(self, token): | |
# load the user from the database | |
return user | |
class ClientFrameworkClass(FrameworkClass, SQLUserFromToken): | |
pass | |
framework_instance = ClientFrameworkClass() | |
framework_instance.do_the_job(...) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment