Philippe May avatar Philippe May committed 0b4e216

Fix get_many with doc_class argument; get_many return iterator; fix typo in get_or_create

Comments (0)

Files changed (1)


 #            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.')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.