forked from platypush/platypush
Fabio Manganiello
36fdcf6963
- Refactored the logic for executing a request and wrapping the response common to procedures, crons and event hook decorators into platypush.common.exec_wrapper - Added mock getvalue() method to Logger to prevent PyCharm failures in the tests when sys.stdout is redirected to the Logger object
23 lines
426 B
Python
23 lines
426 B
Python
from functools import wraps
|
|
from logging import getLogger
|
|
|
|
from platypush.common import exec_wrapper
|
|
|
|
logger = getLogger(__name__)
|
|
|
|
|
|
def cron(cron_expression: str):
|
|
def wrapper(f):
|
|
f.cron = True
|
|
f.cron_expression = cron_expression
|
|
|
|
@wraps(f)
|
|
def wrapped(*args, **kwargs):
|
|
return exec_wrapper(f, *args, **kwargs)
|
|
|
|
return wrapped
|
|
|
|
return wrapper
|
|
|
|
|
|
# vim:sw=4:ts=4:et:
|