Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Wrap the Database.info result to a TrombiDict

  • Loading branch information...
commit 6f1501e5d05c8931f7cd0de2dcadd96958757605 1 parent a736187
Petri Lehtinen authored
Showing with 9 additions and 1 deletion.
  1. +1 −0  test/test_client.py
  2. +8 −1 trombi/client.py
1  test/test_client.py
View
@@ -260,6 +260,7 @@ def get_info(db):
db.info(check_info)
def check_info(info):
+ eq(info.error, False)
eq(info['db_name'], 'testdb')
eq(info['doc_count'], 0)
assert 'update_seq' in info
9 trombi/client.py
View
@@ -99,6 +99,13 @@ def __init__(self, data):
super(TrombiResult, self).__init__()
+class TrombiDict(dict):
+ error = False
+
+ def to_basetype(self):
+ return dict(self)
+
+
def _jsonize_params(params):
result = dict()
for key, value in params.iteritems():
@@ -257,7 +264,7 @@ def _fetch(self, url, *args, **kwargs):
def info(self, callback):
def _really_callback(response):
if response.code == 200:
- callback(json.loads(response.body))
+ callback(TrombiDict(json.loads(response.body)))
else:
callback(_error_response(response))
Please sign in to comment.
Something went wrong with that request. Please try again.