Skip to content

Instantly share code, notes, and snippets.

@major
Created August 8, 2012 14:59
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 major/3295666 to your computer and use it in GitHub Desktop.
Save major/3295666 to your computer and use it in GitHub Desktop.
def _regexp_filter_by_column(instance, filter_name, filter_re):
try:
v = getattr(instance, filter_name)
except AttributeError:
return True
if v and filter_re.match(str(v.encode('utf-8'))):
return True
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment