parent
c054712920
commit
c07d3967aa
@ -0,0 +1,67 @@
|
|||||||
|
"""Sherlock Notify Module
|
||||||
|
|
||||||
|
This module defines the objects for notifying the caller about the
|
||||||
|
results of queries.
|
||||||
|
"""
|
||||||
|
from result import QueryStatus
|
||||||
|
|
||||||
|
|
||||||
|
class QueryNotify():
|
||||||
|
"""Query Notify Object.
|
||||||
|
|
||||||
|
Base class that describes methods available to notify the results of
|
||||||
|
a query.
|
||||||
|
It is intended that other classes inherit from this base class and
|
||||||
|
override the methods to implement specific functionality.
|
||||||
|
"""
|
||||||
|
def __init__(self, result=None):
|
||||||
|
"""Create Query Notify Object.
|
||||||
|
|
||||||
|
Contains information about a specific method of notifying the results
|
||||||
|
of a query.
|
||||||
|
|
||||||
|
Keyword Arguments:
|
||||||
|
self -- This object.
|
||||||
|
result -- Object of type QueryResult() containing
|
||||||
|
results for this query.
|
||||||
|
|
||||||
|
Return Value:
|
||||||
|
Nothing.
|
||||||
|
"""
|
||||||
|
|
||||||
|
self.result = result
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
def update(self, result):
|
||||||
|
"""Notify Update.
|
||||||
|
|
||||||
|
Notify method for query result. This method will typically be
|
||||||
|
overridden by higher level classes that will inherit from it.
|
||||||
|
|
||||||
|
Keyword Arguments:
|
||||||
|
self -- This object.
|
||||||
|
result -- Object of type QueryResult() containing
|
||||||
|
results for this query.
|
||||||
|
|
||||||
|
Return Value:
|
||||||
|
Nothing.
|
||||||
|
"""
|
||||||
|
|
||||||
|
self.result = result
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
"""Convert Object To String.
|
||||||
|
|
||||||
|
Keyword Arguments:
|
||||||
|
self -- This object.
|
||||||
|
|
||||||
|
Return Value:
|
||||||
|
Nicely formatted string to get information about this object.
|
||||||
|
"""
|
||||||
|
result = str(self.result)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
Loading…
Reference in new issue