[Grok-dev] constructing URL for a RESTLayer view
Joshua Immanuel
josh at hipro.co.in
Sat Mar 9 02:50:24 UTC 2013
Hello Christian,
Thanks for the reply.
On Fri, 2013-03-08 at 22:45 +0100, Christian Klinger wrote:
> you can have a look here. It should give you an idea how it *could*
> work. I am not 100% sure if it works with RestLayers too.
>
> https://github.com/zopefoundation/grokcore.view/blob/master/src/grokcore/view/ftests/url/url.py#L174
>
This code is a part of grokcore.view-2.8. Moreover, from the following
snippet
>>> from zope.publisher.browser import applySkin
>>> request = TestRequest()
>>> applySkin(request, URLTestingSkin)
>>> # Shifting names normally happens during URL traversal.
>>> request._traversed_names = ['++skin++urltesting']
>>> request.shiftNameToApplication()
>>> index_view = component.getMultiAdapter((manfred, request),
name='test')
>>> index_view.url()
'http://127.0.0.1/++skin++urltesting/herd/manfred/test'
And seeing the code from grokcore/view/util.py we find that the url is
manually manipulated with '++skin++' and it will not work for RESTLayer.
So, taking clue from this I too manipulated the url path with '++rest++'
string manually (for the time being).
Is there any other better way of doing 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/5881348d/attachment.sig>
More information about the Grok-dev
mailing list