Skip to content

Commit

Permalink
Update docstring about sync utils deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
rudyryk committed Apr 18, 2016
1 parent 597b930 commit acb8da5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions peewee_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,8 +1023,14 @@ def connect_kwargs_async(self):
def sync_unwanted(database):
"""Context manager for preventing unwanted sync queries.
`UnwantedSyncQueryError` exception will raise on such query.
NOTE: sync_unwanted() context manager is **deprecated**, use
database `allow_sync` property directly or via `Manager.allow_sync()`
context manager.
"""
warnings.warn("sync_unwanted() context manager is deprecated",
warnings.warn("sync_unwanted() context manager is deprecated, "
"use database `allow_sync` property directly or "
"via Manager `allow_sync()` context manager. ",
DeprecationWarning)
old_allow_sync = database.allow_sync
database.allow_sync = False
Expand All @@ -1034,9 +1040,12 @@ def sync_unwanted(database):

class UnwantedSyncQueryError(Exception):
"""Exception which is raised when performing unwanted sync query.
NOTE: UnwantedSyncQueryError is deprecated, `assert` is used instead.
"""
def __init__(self, *args, **kwargs):
warnings.warn("UnwantedSyncQueryError is deprecated",
warnings.warn("UnwantedSyncQueryError is deprecated, "
"assert is used instead.",
DeprecationWarning)


Expand Down

0 comments on commit acb8da5

Please sign in to comment.