Merge lp:~cjwatson/storm/py3-listify-resultset into lp:storm
Proposed by
Colin Watson
Status: | Merged |
---|---|
Merged at revision: | 553 |
Proposed branch: | lp:~cjwatson/storm/py3-listify-resultset |
Merge into: | lp:storm |
Diff against target: |
147 lines (+72/-2) 5 files modified
NEWS (+8/-0) setup.py (+1/-0) storm/store.py (+3/-0) storm/tests/zope/README.txt (+53/-0) storm/zope/configure.zcml (+7/-2) |
To merge this branch: | bzr merge lp:~cjwatson/storm/py3-listify-resultset |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Simon Poirier (community) | Approve | ||
Review via email: mp+382961@code.launchpad.net |
Commit message
Fix list() on security-proxied ResultSets on Python 3.
Description of the change
On Python 3, list() calls len() internally to preallocate the correct amount of space if possible. If __len__ is unimplemented, then it falls back to guessing, but ForbiddenAttribute confuses it and results in failing to create the list. Allowing __len__ through the security proxy, even though it's unimplemented, avoids this.
(We don't want to implement ResultSet.__len__ in terms of ResultSet.count because it would make it too easy to write code that implicitly issued extra SQL queries. On the other hand, EmptyResultSet.
To post a comment you must log in.
+1 LGTM