named operations on scoped collections fails with "No such operation"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lazr.restful |
Triaged
|
Low
|
Unassigned |
Bug Description
When creating a named operation on a ScopedCollection, Invoking the named operation fails with a "No Such Operation" error
When digging into this issue, I noted that self.context inside the CustomOperation
ScopedCollection class instead of the instance of the collection itself.. The workaround is to call self.context.
It seems like this problem could be residing somewhere higher-up in the call chain, although making the below fix doesn't seem to break anything else and doing a normal GET of a ScopedCollection works regardless of having the change(s) noted below:
A workaround can be done in the handleCustomGET
--- lazr.restful-
+++ lazr.restful-
@@ -667,8 +667,13 @@
:return: The result of the operation: either a string or an
object that needs to be serialized to JSON.
"""
+ context = self.context
+ if IScopedCollecti
+ # The 'context' of a ScopedCollection is actually stored in its
+ # collection property.
+ context = self.context.
try:
- operation = getMultiAdapter
+ operation = getMultiAdapter
except ComponentLookup
@@ -685,8 +690,13 @@
:return: The result of the operation: either a string or an
object that needs to be serialized to JSON.
"""
+ context = self.context
+ if IScopedCollecti
+ # The 'context' of a ScopedCollection is actually stored in its
+ # collection property.
+ context = self.context.
try:
- operation = getMultiAdapter
+ operation = getMultiAdapter
except ComponentLookup
This looks reasonable to me.
FWIW, if Leonard doesn't object and you gave us a branch with tests, that would make this happen fastest.