mirror of
https://github.com/pretix/pretix.git
synced 2026-08-10 10:47:00 +00:00
add documentation
This commit is contained in:
@@ -10,6 +10,8 @@ product can be bought, you should use :py:meth:`time_machine_now`.
|
||||
|
||||
.. autofunction:: pretix.base.timemachine.time_machine_now
|
||||
|
||||
.. autofunction:: pretix.base.timemachine.time_machine_now_assigned
|
||||
|
||||
Background tasks
|
||||
----------------
|
||||
|
||||
|
||||
@@ -60,6 +60,11 @@ def time_machine_now(default=False):
|
||||
|
||||
@contextmanager
|
||||
def time_machine_now_assigned(now_dt):
|
||||
"""
|
||||
Use this context manager to assign current datetime for time machine mode. Useful e.g. for background tasks.
|
||||
|
||||
:param now_dt: The datetime value to assign. May be `None` to disable time machine.
|
||||
"""
|
||||
try:
|
||||
timemachine_now_var.set(now_dt)
|
||||
yield
|
||||
|
||||
Reference in New Issue
Block a user