Skip to content
Permalink
Browse files
Added docstring.
  • Loading branch information
felixfontein committed Sep 8, 2015
1 parent 2ba6025 commit da5f3501d69980a5815dc8d0e62d2f00adbb9270
Showing with 15 additions and 1 deletion.
  1. +15 −1 nikola/utils.py
@@ -1069,7 +1069,21 @@ def reset(cls):
cls.formatted_date_handlers = []

@classmethod
def add_handler(cls, month_name_handler, formatted_date_handler):
def add_handler(cls, month_name_handler=None, formatted_date_handler=None):
"""Allow to add month name and formatted date handlers.
If month_name_handler is not None, it is expected to be a callable
which accepts (month_no, lang) and returns either a string or None.
If formatted_date_handler is not None, it is expected to be a callable
which accepts (date_format, date, lang) and returns either a string or
None.
A handler is expected to either return the correct result for the given
language and data, or return None to indicate it is not able to do the
job. In that case, the next handler is asked, and finally the default
implementation is used.
"""
if month_name_handler is not None:
cls.month_name_handlers.append(month_name_handler)
if formatted_date_handler is not None:

0 comments on commit da5f350

Please sign in to comment.