Merge lp:~thisfred/u1db/iterate-over-list-of-dicts into lp:u1db
Status: | Merged |
---|---|
Approved by: | Eric Casteleijn |
Approved revision: | 372 |
Merged at revision: | 366 |
Proposed branch: | lp:~thisfred/u1db/iterate-over-list-of-dicts |
Merge into: | lp:u1db |
Diff against target: |
349 lines (+130/-69) 5 files modified
src/u1db_query.c (+74/-46) u1db/query_parser.py (+25/-17) u1db/tests/test_backends.py (+20/-0) u1db/tests/test_query_parser.py (+10/-5) u1db/tests/test_sqlite_backend.py (+1/-1) |
To merge this branch: | bzr merge lp:~thisfred/u1db/iterate-over-list-of-dicts |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Samuele Pedroni | Approve | ||
Review via email: mp+117120@code.launchpad.net |
Commit message
Added support for indexing dictionaries in lists, so this becomes possible:
doc = self.db.
Description of the change
Added support for indexing dictionaries in lists, so this becomes possible:
doc = self.db.
+ subfields = self.field. split(' .')
I would move this to the constructor
255 + return extract_ field(raw_ doc, subfields)
+def extract_ field(raw_ doc, subfields): get(subfields. pop(0))
206 + if not isinstance(raw_doc, dict):
207 + return []
208 + val = raw_doc.
I would use a index argument and avoid the pop (especially pop(0)) and copy
216 + subfields = []
this line is not needed
same for these:
223 + if val is None:
224 + return []
line 209-210 cover that