Merge lp://qastaging/~teknico/desktopcouch/dont-get-deleted-records into lp://qastaging/desktopcouch

Proposed by Nicola Larosa
Status: Merged
Approved by: Eric Casteleijn
Approved revision: 77
Merged at revision: not available
Proposed branch: lp://qastaging/~teknico/desktopcouch/dont-get-deleted-records
Merge into: lp://qastaging/desktopcouch
Diff against target: 32 lines
2 files modified
desktopcouch/records/server_base.py (+3/-0)
desktopcouch/records/tests/test_server.py (+8/-0)
To merge this branch: bzr merge lp://qastaging/~teknico/desktopcouch/dont-get-deleted-records
Reviewer Review Type Date Requested Status
Eric Casteleijn (community) Approve
Vincenzo Di Somma (community) Approve
Review via email: mp+12706@code.qastaging.launchpad.net

Commit message

The get_record of CouchDatabaseBase does not take the deleted flag into account, happily getting records flagged as deleted. This branch includes a test exposing the problem, and a fix for it.

To post a comment you must log in.
Revision history for this message
Nicola Larosa (teknico) wrote :

The get_record of CouchDatabaseBase does not take the deleted flag into account, happily getting records flagged as deleted. This branch includes a test exposing the problem, and a fix for it.

Revision history for this message
Vincenzo Di Somma (vds) wrote :

Looks good.

review: Approve
Revision history for this message
Eric Casteleijn (thisfred) wrote :

Looks great, tests pass!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'desktopcouch/records/server_base.py'
2--- desktopcouch/records/server_base.py 2009-09-30 15:52:29 +0000
3+++ desktopcouch/records/server_base.py 2009-10-01 09:10:23 +0000
4@@ -132,6 +132,9 @@
5 except ResourceNotFound:
6 return None
7 data = {}
8+ if 'deleted' in couch_record.get('application_annotations', {}).get(
9+ 'Ubuntu One', {}).get('private_application_annotations', {}):
10+ return None
11 data.update(couch_record)
12 record = self.record_factory(data=data)
13 record.record_id = record_id
14
15=== modified file 'desktopcouch/records/tests/test_server.py' (properties changed: +x to -x)
16--- desktopcouch/records/tests/test_server.py 2009-09-14 16:53:15 +0000
17+++ desktopcouch/records/tests/test_server.py 2009-10-01 09:10:23 +0000
18@@ -89,6 +89,14 @@
19 self.assert_(deleted_record['application_annotations']['Ubuntu One'][
20 'private_application_annotations']['deleted'])
21
22+ def test_get_deleted_record(self):
23+ """Test (not) getting a deleted record."""
24+ record = Record({'record_number': 0}, record_type="http://example.com/")
25+ record_id = self.database.put_record(record)
26+ self.database.delete_record(record_id)
27+ retrieved_record = self.database.get_record(record_id)
28+ self.assertEqual(None, retrieved_record)
29+
30 def test_record_exists(self):
31 """Test checking whether a record exists."""
32 record = Record({'record_number': 0}, record_type="http://example.com/")

Subscribers

People subscribed via source and target branches