Skip to content

Instantly share code, notes, and snippets.

@kitsunde
Created May 22, 2015 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kitsunde/c567417f6672517b0390 to your computer and use it in GitHub Desktop.
Save kitsunde/c567417f6672517b0390 to your computer and use it in GitHub Desktop.
class IsAuthenticated(object):
def __init__(self, origin):
self.origin = origin
def __nonzero__(self):
raise Exception("lol noob")
def __call__(self, *args, **kwargs):
return self.origin._noob_is_authenticated()
class MartinsUser(User):
def __init__(self, *args, **kwargs):
super(MartinsUser, self).__init__(*args, **kwargs)
self._noob_is_authenticated = self.is_authenticated
self.is_authenticated = IsAuthenticated(self)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment