batching collections containing basic python types

Bug #677671 reported by Edwin Grubbs
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
lazr.restful
Triaged
Low
Unassigned

Bug Description

Launchpad sometimes wraps a storm result set with a DecoratedResultSet object, so that an efficient query can be used for batching that only selects the rows needed, but each row may be transformed into a dictionary. Though lazr.restful has no problems JSON encoding a list of dictionaries, the lazr.restful code that provides batching functionality expects each item to have an adapter to an IEntry, which the export_as_webservice_entry() decorator normally enables.

lazr.restful._operation.ResourceOperation.should_batch() turns off batching for lists of dictionaries. When another collection is used that should_batch() says yes to, lazr.restful._resource.BatchingResourceMixin.batch() tries to instantiate an EntryResource object, which cannot handle object that can't be adapted to an IEntry. In Launchpad, batch() will fail before it instantiates an EntryResource, since it calls checkPermission() on the dict, and checkPermission() causes an exception when it tries to put the dict in a weakref. Perhaps, canAccess() should be used instead of checkPermission().

Revision history for this message
Gary Poster (gary) wrote :

Edwin, is this affecting code now, or is there a known workaround?

Changed in lazr.restful:
status: New → Triaged
importance: Undecided → Medium
Changed in lazr.restful:
importance: Medium → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.