[Grok-dev] Getting a view from within a REST layer

Peter Bengtsson peter at fry-it.com
Mon Dec 10 14:03:11 EST 2007


getMultiAdapter((context, request), name="Nameofview")
doesn't work inside my REST layer which I built thanks to this tutorial:
http://grok.zope.org/minitutorials/rest.html

This is the error I get:
     raise ComponentLookupError(objects, interface, name)
ComponentLookupError: ((<snapatom.app.snapatom object at 0x8b7f6ac>, 
<InterfaceClass zope.interface.Interface>), <InterfaceClass 
zope.interface.Interface>, 'bloglist')




I don't want to paste in all the code so here's the pseudo code:

class snapatom(grok.Application, grok.Container):
     stuff

class Bloglist(grok.View):
     grok.context(snapatom)
     grok.name('bloglist')
    # now http://localhost:8080/snapatom/bloglist works

class AtomPubLayer(grok.IRESTLayer):
     pass

class AtomPubProtocol(grok.RESTProtocol):
     grok.layer(AtomPubLayer)
     grok.name('atompub')


class MyREST(grok.REST):
     grok.layer(AtomPubLayer)
     grok.context(snapatom)

     def GET(self):
         stuff

         # this is where I get a component lookup error
         getMultiAdapter((context, request), name="bloglist")


Am I doing it completely wrong or is it a bug?
I basically want to render a view and spit out its result in the method 
GET() of my REST layer.

Thanks,
Peter

-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com


More information about the Grok-dev mailing list