zulip_bots: Add function to get absolute path to the bots/ dir.

This is part of our efforts to have the documentation for a
particular bot live in this repo but still be able to render it
in the main repo (in a way similar to how we render the webhooks
docs).

This function allows the calling code to get the absolute path
to the bots/ directory. This will allow us to specify an
arbitrary path (jinja2.env.loader.searchpath)
to look for templates for bots' documentation.
This commit is contained in:
Eeshan Garg 2017-08-15 19:45:17 -02:30 committed by Tim Abbott
parent 824000f32b
commit aee564825f

View file

@ -35,6 +35,11 @@ def get_bot_logo_path(name):
return None return None
def get_bots_directory_path():
# type: () -> str
current_dir = os.path.dirname(os.path.abspath(__file__))
return os.path.join(current_dir, 'bots')
class RateLimit(object): class RateLimit(object):
def __init__(self, message_limit, interval_limit): def __init__(self, message_limit, interval_limit):
# type: (int, int) -> None # type: (int, int) -> None