[Zope-CMF] More browser views

yuppie y.2010 at wcm-solutions.de
Fri Apr 9 06:06:44 EDT 2010


Hi!


Charlie Clark wrote:
> Am 07.04.2010, 13:47 Uhr, schrieb Jens Vagelpohl<jens at dataflake.org>:
>
>> I think I would change the cookie crumbler to expect both: Either a page
>> with an ID that the cookie crumbler can traverse to (which is what it
>> does right now), or an ID for a view that you could traverse to using
>> the "@@" notation.
>
> Sort of:
>
> try:
> 	page.getId()
> except AttributeError:
> 	page.restrictedTraverse() # or getMultiAdapter((context, request), name=)
>
> I'm a bit hazy on traversal. Actually I'm a bit useless on it!

getUnauthorizedURL is already using restrictedTraverse. This only fails 
because it starts from self instead of the parent (=portal root) and the 
login form is usually not registered for the cookie crumbler.

And it tries to call absolute_url(). Views don't have that method.


An other approach would be to look up the URLs in the Actions tool. The 
login URL is already specified in the 'user/login' Action, an invisible 
logged_out Action could be added. Long time ago the cookie crumbler had 
a stand alone version, so there are no dependencies on other tools. But 
now I would prefer to avoid redundant settings.


Cheers,

	Yuppie


More information about the Zope-CMF mailing list