Created
October 16, 2015 16:48
-
-
Save juliedavila/98c03343a8a491edeed5 to your computer and use it in GitHub Desktop.
Boiler plate for filter plugin
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
from jinja2 import contextfilter | |
class FilterModule(object): | |
''' Extra filters ''' | |
def filters(self): | |
return { | |
'nameoffilter': self.name_of_method, | |
} | |
def name_of_method(self, firstarg, secondarg): | |
# do stuff | |
return | |
# def deeplist(self, obj, key): | |
# r = [] | |
# for x in obj: | |
# if key in x: | |
# r.append(x[key]) | |
# return r | |
# def percent(self, percent, total): | |
# return (total * (float(str(percent).strip('%')) / 100.0)) | |
# def basic(self, a=None): | |
# return a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment