[Grok-dev] constructing URL for a RESTLayer view

Joshua Immanuel josh at hipro.co.in
Fri Mar 8 21:07:52 UTC 2013


Hello,

Is there a way to construct an URL for a RESTLayer's view dynamically,
without me injecting the '++rest++<skin_name>' string into the URL
manually.

My use-case is as follows,

        class MyNormalView(grok.View):
            grok.context(IMyContext)
            grok.name('my_view')
            grok.template('some_template')
        
            def update(self):
                # I wan't to construct an URL for MyRESTView's GET
                # here using the self.context so that it can be used 
        	# in the template
                pass
        
        class MyRESTLayer(grok.IRESTLayer):
            grok.restskin('myskin')
        
        class MyRESTView(grok.REST):
            grok.context(IMyContext)
            grok.layer(MyRESTLayer)
        
            def GET(self):
                return "REST: GET request"
        
Can someone enlighten me on this.

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://mail.zope.org/pipermail/grok-dev/attachments/20130309/bd286529/attachment.sig>


More information about the Grok-dev mailing list