Skip to content

Commit

Permalink
Fixing bug with decorators and help
Browse files Browse the repository at this point in the history
Since we depend on __doc__ for the help documentaiton I am adding
the use of functools to preserve the __doc__ string when decorating
functions from utils.
  • Loading branch information
attzonko authored Jan 21, 2019
1 parent e45c4b7 commit 0f197bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/dev_install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Installation for development
$ pip install -r requirements.txt
$ pip install -r docs/requirements.txt
$ touch local_settings.py # configure your local settings
$ matterbot # run bot
$ mmpy_bot # run bot
.. code-block:: python
Expand Down
3 changes: 3 additions & 0 deletions mmpy_bot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging

from six.moves import _thread, queue
from functools import wraps

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -34,6 +35,7 @@ def do_work(self):

def allow_only_direct_message():
def plugin(func):
@wraps(func)
def wrapper(message, *args, **kw):
if not message.is_direct_message():
return message.reply("`Only direct messages is allowed`")
Expand All @@ -46,6 +48,7 @@ def wrapper(message, *args, **kw):

def allowed_users(*allowed_users_list):
def plugin(func):
@wraps(func)
def wrapper(message, *args, **kw):
user = message.get_username()
user_email = message.get_user_mail()
Expand Down

0 comments on commit 0f197bb

Please sign in to comment.