Skip to content

Commit

Permalink
Added docstring.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Sep 8, 2015
1 parent 2ba6025 commit da5f350
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion nikola/utils.py
Expand Up @@ -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:
Expand Down

0 comments on commit da5f350

Please sign in to comment.