From f3322b7e8edebe42a0aaaf3cf9958103195cc8ae Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Thu, 4 Sep 2014 15:39:51 +0000 Subject: [PATCH] support for /streams and using oahu driver --- quince/v1_impl.py | 31 +++++++++++++++++++++++++++++-- requirements.txt | 1 + 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/quince/v1_impl.py b/quince/v1_impl.py index dbb3d37..ac7f2e0 100644 --- a/quince/v1_impl.py +++ b/quince/v1_impl.py @@ -13,7 +13,34 @@ # See the License for the specific language governing permissions and # limitations under the License. +import oahu.config + class Impl(object): - def get_events(self, resp): - return [] + def __init__(self, config, scratchpad): + """config is a ConfigParser object. + Use the scratchpad to ensure we don't create multiple + connections to the db. + """ + + if 'quincy_config' not in scratchpad: + target = config.get('quince', 'oahu_config') + print "Quince is using oahu driver from %s" % target + quincy_config = oahu.config.get_config(target) + scratchpad['quincy_config'] = quincy_config + scratchpad['quincy_driver'] = quincy_config.get_driver() + + self.oahu_config = scratchpad['quincy_config'] + self.driver = scratchpad['quincy_driver'] + + def get_streams(self, **kwargs): + return self.driver.find_streams(**kwargs) + + def get_stream(self, stream_id, details): + return None + + def delete_stream(self, stream_id): + pass + + def reset_stream(self, stream_id): + pass diff --git a/requirements.txt b/requirements.txt index e69de29..2c0a1b9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1 @@ +oahu