Fixed #962 -- Gave filter-registration decorator a return statement. Thanks, Kieran

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1497 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-11-30 00:08:56 +00:00
parent 289119563e
commit e2e98aff6a
1 changed files with 3 additions and 2 deletions

View File

@ -788,7 +788,7 @@ class Library(object):
self.filters = {} self.filters = {}
self.tags = {} self.tags = {}
def tag(self, name = None, compile_function = None): def tag(self, name=None, compile_function=None):
if name == None and compile_function == None: if name == None and compile_function == None:
# @register.tag() # @register.tag()
return self.tag_function return self.tag_function
@ -812,7 +812,7 @@ class Library(object):
self.tags[func.__name__] = func self.tags[func.__name__] = func
return func return func
def filter(self, name = None, filter_func = None): def filter(self, name=None, filter_func=None):
if name == None and filter_func == None: if name == None and filter_func == None:
# @register.filter() # @register.filter()
return self.filter_function return self.filter_function
@ -828,6 +828,7 @@ class Library(object):
elif name != None and filter_func != None: elif name != None and filter_func != None:
# register.filter('somename', somefunc) # register.filter('somename', somefunc)
self.filters[name] = filter_func self.filters[name] = filter_func
return filter_func
else: else:
raise InvalidTemplateLibrary, "Unsupported arguments to Library.filter: (%r, %r, %r)", (name, compile_function, has_arg) raise InvalidTemplateLibrary, "Unsupported arguments to Library.filter: (%r, %r, %r)", (name, compile_function, has_arg)