Hi Chris!

Chris Withers wrote:
yuppie wrote:
yuppie wrote:
Okay, so how would you get the url for an action from inside a skin script or template?

obj.getActionInfo('object/view')['url'] for type actions or
provider.getActionInfo('user/join')['url'] for other actions.

Now, do these return full urls or just the last segment, like getActionById used to?

The full URL.

getActionInfo returns the same kind of dict as listFilteredActionsFor returns for each Action. It is just a cheaper way to get a single ActionInfo dict.

      - url (string): URL to access the action

This is the result of the url expression in the current request context.

Sorry, not aure I got that... The result of evaluating the url expression in the context of the current request? Still not sure what that means... examples?

If you define an Action you specify a TALES expression for the URL.

"string:${object_url}/document_view"
"string:${portal/portal_membership/getHomeUrl}/folder_contents"

In the skin you normally need the resulting string to add links or set redirects:

"http://www.example.org/foo.doc/document_view";
"http://www.example.org/Members/user_bar/folder_contents";

These URLs depend on the request. In these examples you get different results for different objects and users.

In CMF 1.5 it is no longer necessary to add 'document_view' at the end if it is the default view. "string:${object_url}" -> "http://www.example.org/foo.doc"; also works. But not if you use getActionById.

It is always useful if you want a link or redirect target - for traversal use queryMethodID instead.

What do you mean here by "for traversal"?

I meant direct traversal calling attributes or using restrictedTraverse. Without a redirect and new request traversal.


Cheers,

        Yuppie


_______________________________________________
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to