Open jaroel opened 9 years ago
Different views can be done like:
A marker object for the view argument signals the default view. This is the default setting.
def get_link(context, view=_marker, html=False): pass
I don't really see that this is adding much. In the second example, you already have the object and the view name. Why would you not just use absolute url?
I may be misunderstanding your use-case here, but this doesn't sound like it fits with the goals of plone.api (in particular: "...to cover 20% of the tasks any Plone developer does 80% of the time.")
@adamcheasley the second example is just to be feature complete. Don't really care for that except that I can use the same API everywhere.
@mattss I have to generate 'a' tags and check permissions all the time when I make custom views. I don't like to do that :)
Using the catalog will check permissions for you. It's then not too much trouble to use brain.getURL() to get the equivalent to absolute_url.
@jaroel don't get me wrong - it sounds like a good pattern for your use case, but it's not a common use case in my own experience.
@adamcheasley True, although I don't always have brains :) @mattss Not a problem - neither is .folder.list_content().
Just let this sink for a bit, we'll check again in a few days :)
If the object is the default content item of its container, this should return the link to the container.
I think there's a bit more logic than just ${context/absolute_url}. I'll draft an implementation
This should probably accept an uuid.
plone.api.content.get_link(uuid='ce380ef0f10a85beb864025928e1819b')
Since I'm linking to a lot of objects, I'd like a helper method and view (ie @@view_link and @@view_url) that returns an chameleon.utils.Markup object or plain html (html=True argument).
This call can be used to create an a tag that:
Would be nice: