Oops! Should have had a better look at the Plone code. I thought you
need the object.
Now in plone, they do:
The best I've managed to come up with to replace that is:
from Products.CMFCore.utils import getActionContext
for possible in ('object/view','folder/view'):
action = typeInfo.getActionObject(possible)
if action is not None:
raise RuntimeError('No sensible view found for'+repr(typeInfo))
...which seems pretty heavyweight to me :-S
There's also plenty more apprently legit uses of getActionByID in the
code, which has left me wondering exactly why this method was
deprecated, given that the suggested replacements don't really seem to
cut it :-(
Well. getActionByID did make sense before type actions became normal
actions in CMF 1.4. Since than getActionByID is an ugly backwards
compatibility hack that tries to guess the called method from an
expression string that defines a context dependent URL.
That may be, but how would you code what's being done above?
It seems like a moderately legitimate use to me, but I may be missing
getActionByID has irresolvable bugs because it tries to do something
And what is that?
It only does what you expect as long as you make sure your
action expressions are parsable by getActionByID.
What does that mean, in simple terms?
I doubt your use case is a legit use case.
As I said before, how would you code the above?
What are the "plenty more apparently legit uses of getActionByID"?
Well, legit may be the wrong word, but "I can't thing how to implement
this other than by having a getActionById" :-(
Anyway, here they are:
- in CMFPlone/PloneTool.py, getActionById is used to return only the
last segment of the URL for the action. Surely getActionInfo()['url']
returns the whole url?
Mindyou, what would you expect:
...to return? The complete url, or just the thing to be appended on the
end of the object's url?
If it's the latter, I think it's a grossly misnamed key :-(
Why isn't it called url_segment?
Simplistix - Content Management, Zope & Python Consulting
Zope-CMF maillist - Zope-CMF@lists.zope.org
See http://collector.zope.org/CMF for bug reports and feature requests