Skip to content

Instantly share code, notes, and snippets.

@PEZ
Created May 10, 2010 09:13
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 PEZ/395853 to your computer and use it in GitHub Desktop.
Save PEZ/395853 to your computer and use it in GitHub Desktop.
@property
def type(self):
stripped = re.sub(r'Notification$', '', self.__class__.__name__)
if stripped != '':
return re.sub(r'([a-z])([A-Z])', '%s_%s' % (r'\1', r'\2'), stripped).lower()
else:
return 'generic'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment