Skip to content

Commit

Permalink
#7: Docstrings in status_handler.py updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bystroushaak committed Dec 8, 2015
1 parent 4699103 commit 8ccea74
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/edeposit/amqp/rest/database/status_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,15 @@ def query_status(self, rest_id, username=None):
rest_id (str): Unique identificator of given REST request.
username (str, default None): Name of the user. If not set, the
username will not be checked.
Raises:
IndexError: If the user wasn't registered to receive status
updates.
AccessDeniedException: If the optional parameter `username` doesn't
fit to given `rest_id`.
Returns:
obj: :class:`StatusInfo` for given `rest_id`.
"""
status_info_obj = self.status_db.get(rest_id, None)
db_username = self.id_to_username.get(rest_id, None)
Expand Down Expand Up @@ -288,6 +297,9 @@ def query_statuses(self, username):
Args:
username (str): Selected username.
Raises:
IndexError: If username was not found in database.
Returns:
list: List of :class:`StatusInfo` objects sorted by creation time.
"""
Expand Down Expand Up @@ -322,6 +334,10 @@ def remove_status_info(self, rest_id, username=None):
rest_id (str): Unique identificator of given REST request.
username (str, default None): Name of the user. If not set, the
username will not be checked.
Raises:
AccessDeniedException: In case that optional `username` parameter
doesn't match with given `rest_id`.
"""
session = random.randint(0, 100000)
self.log("Request to remove StatusInfo(%s)." % repr(rest_id), session)
Expand Down Expand Up @@ -368,6 +384,13 @@ def remove_status_info(self, rest_id, username=None):

@transaction_manager
def remove_user(self, username):
"""
Remove tracking of the `username`.
Args:
username (str): Name of the user. If the user is not registered,
then it is ignored.
"""
ids = self.username_to_ids.get(username, None)

if ids is None:
Expand Down

0 comments on commit 8ccea74

Please sign in to comment.