コード例 #1
0
 def next(self):
     result = self._wrapped.next()
     key_name = result.key.id()
     result_dict = db.unflatten(result.to_dict(),
                                token_map=self._token_map)
     result_dict['_id'] = key_name
     return result_dict
コード例 #2
0
 def test_db_unflatten(self):
     document = {'_id': 'keyname1', 'deeply|nested|item': 1}
     assert db.unflatten(document) == {
         '_id': 'keyname1',
         'deeply': {
             'nested': {
                 'item': 1
             }
         }
     }
コード例 #3
0
 def next(self):
     result = self._wrapped.next()
     if self._table not in ['metadata','tokenmaps']:
         result = db.unflatten(result, self._token_map)
     return result
コード例 #4
0
 def test_db_flatten_unflatten(self):
     document = {"_id": "keyname1", "nested": {"item": 1}}
     assert db.unflatten(db.flatten(document)) == document
コード例 #5
0
 def test_db_unflatten(self):
     document = {"_id": "keyname1", "deeply|nested|item": 1}
     assert db.unflatten(document) == {"_id": "keyname1", "deeply": {"nested": {"item": 1}}}
コード例 #6
0
 def test_db_flatten_unflatten(self):
     document = {'_id': 'keyname1', 'nested': {'item': 1}}
     assert db.unflatten(db.flatten(document)) == document
コード例 #7
0
 def next(self):
     result = self._wrapped.next()
     key_name = result.key.id()
     result_dict = db.unflatten(result.to_dict(), token_map = self._token_map)
     result_dict['_id'] = key_name
     return result_dict