Andy Mikhailenko committed 3d71555 Merge

Merged with Philippe.

  • Participants
  • Parent commits 1089d4f, 90692e3

Comments (0)

Files changed (4)

 and generally made Models better:
   * Timothée Peignier
+  * Philippe May
   * you? :)
 Patches, ideas and any feedback is highly appreciated.

File doqu/

 #            return result#[1]  # HACK!!!
     def get_many(self, keys, doc_class=dict):
-        """Returns a list of documents with primary keys from given list.
+        """Returns an iterator of documents with primary keys from given list.
         Basically this is just a simple wrapper around
         :meth:`~BaseStorageAdapter.get` but some backends can reimplement the
         method in a much more efficient way.
                           'db.get_many(keys, doc_class) instead', DeprecationWarning)
             keys, doc_class = doc_class, keys
-        return [self._decorate(key, data)
-                           for key, data in self._get_many(keys)]
+        return (self._decorate(key, data, doc_class=doc_class)
+                           for key, data in self._get_many(keys))
     def get_or_create(self, doc_class=dict, **conditions):
         """Queries the database for records associated with given document
         Returns the document instance and a boolean value "created".
-        assert kwargs
+        assert conditions
         if self.connection is None:  # pragma: nocover
             raise RuntimeError('Cannot fetch items: no connection.')

File doqu/ext/mongodb/

     def _get_many(self, keys):
         obj_ids = [self._string_to_object_id(key) for key in keys]
         results = self.connection.find({'_id': {'$in': obj_ids}}) or []
-        print dir(results)
         found_keys = []
         for data in results:
             key = str(self._object_id_to_string(data['_id']))
             yield key, data
         if len(found_keys) < len(keys):
             missing_keys = [k for k in keys if k not in found_keys]
             raise KeyError('collection "{collection}" of database "{database}"'

File doqu/ext/tokyo_cabinet/

     'contains_any': lambda k,v,p: (k, tc.TDBQCSTROR, p(v)),
     'endswith':     lambda k,v,p: (k, tc.TDBQCSTREW, p(v)),
     'equals':       str_or_num('equals'),
-    'exists':       lambda k,v,p: (k, tc.TDBQCSTRRX, ''),
+    'exists':       lambda k,v,p: (k, tc.TDBQCSTRBW, ''),
     'gt':           lambda k,v,p: (k, tc.TDBQCNUMGT, p(v)),
     'gte':          lambda k,v,p: (k, tc.TDBQCNUMGE, p(v)),
     'in':           str_or_num('in'),