Merge lp:~thisfred/u1db/iterate-over-list-of-dicts into lp:u1db
| Status: | Merged |
|---|---|
| Approved by: | Eric Casteleijn on 2012-07-31 |
| 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 | 2012-07-27 | Approve on 2012-07-31 | |
|
Review via email:
|
|||
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.
| Samuele Pedroni (pedronis) wrote : | # |
- 368. By Eric Casteleijn on 2012-07-31
-
split in __init__
- 369. By Eric Casteleijn on 2012-07-31
-
split in __init__
- 370. By Eric Casteleijn on 2012-07-31
-
don't mutate list
| Eric Casteleijn (thisfred) wrote : | # |
Fixes pushed
- 371. By Eric Casteleijn on 2012-07-31
-
don't copy list around
- 372. By Eric Casteleijn on 2012-07-31
-
don't copy list around

+ 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