There's no simple way of constructing URLs to views on different skins
Bug #207640 reported by
Jan Wijbrand Kolman
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grok |
Won't Fix
|
Low
|
Martijn Faassen | ||
1.0 |
Won't Fix
|
Low
|
Martijn Faassen | ||
1.1 |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
It is currently not possible to easily construct an URL to a view on a different skin/layer. E.g. when you want some view to construct an URL to some REST view.
Changed in grok: | |
milestone: | none → 1.0 |
Changed in grok: | |
status: | Confirmed → Won't Fix |
To post a comment you must log in.
There is a hard way, inspired on http:// jw.n--tree. net/irclogs/ %23grok/ %23grok. 2008-03- 27.log. html :
class ContentRESTLaye r(grok. IRESTLayer) :
pass
class ContentRESTProt ocol(grok. RESTProtocol) : layer(ContentRE STLayer)
grok.
# A REST handler is not a view; provide a dummy Container that is
# always published using a REST handler. This container can then be
# given its place in the urlspace.
# Note that the context which is probably needed is the __parent__ of
# the context of this container.
class ContentRESTView (grok.Container ):
def render(self):
return "i don't exist"
from zope.app. publication. interfaces import IBeforeTraverse Event
from zope.publisher.http import applySkin
@grok.subscribe (ContentRESTVie w, IBeforeTraverse Event) Hack(obj, event): event.request, ContentRESTLayer, grok.IRESTSkinType)
def ContentRESTView
applySkin(
class ContentRESTView Handler( grok.REST) : context( ContentRESTView ) layer(ContentRE STLayer)
grok.
grok.
def GET(self): __parent_ _ somemethod( )
context = self.context.
return context.