Merge lp:~jameinel/u1db/delete_doc into lp:u1db
Proposed by
John A Meinel
Status: | Merged |
---|---|
Merged at revision: | 128 |
Proposed branch: | lp:~jameinel/u1db/delete_doc |
Merge into: | lp:u1db |
Diff against target: |
217 lines (+47/-44) 5 files modified
u1db/__init__.py (+2/-3) u1db/backends/inmemory.py (+8/-8) u1db/backends/sqlite_backend.py (+10/-7) u1db/tests/test_backends.py (+17/-14) u1db/tests/test_sync.py (+10/-12) |
To merge this branch: | bzr merge lp:~jameinel/u1db/delete_doc |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Samuele Pedroni | Approve | ||
Review via email: mp+83408@code.launchpad.net |
Description of the change
Implement Database.
I also updated this test:
def test_delete_
doc = self.db.
orig_rev = doc.rev
Adding that last line is to be clear that get_doc() should return a document with content = None.
assertGetDoc was already doing so, but it may be clearer if we do an explicit check.
To post a comment you must log in.
looks good, interestingly if I do this change:
=== modified file 'u1db/backends/ inmemory. py' inmemory. py 2011-11-25 15:19:55 +0000 inmemory. py 2011-11-25 18:30:55 +0000 itervalues( ):
index. remove_ json(doc_ id, old_content)
index. add_json( doc_id, content)
self. _docs[doc_ id] = (new_rev, content)
self. _transaction_ log.append( doc_id) doc.doc_ id][1] in ('null', None): doc.doc_ id][1] in (None,):
doc.content = None
self. put_doc( doc)
--- u1db/backends/
+++ u1db/backends/
@@ -81,7 +81,7 @@
for index in self._indexes.
if old_content is not None:
- if content not in (None, 'null'):
+ if content not in (None,):
@@ -133,7 +133,7 @@
def delete_doc(self, doc):
if doc.doc_id not in self._docs:
raise KeyError
- if self._docs[
+ if self._docs[
raise KeyError
no tests fail as well