[CMF-checkins] CVS: Products/CMFDefault/skins/zpt_generic -
permalink.py:1.1 main_template.pt:1.14
Grégoire Weber
zope.org at incept.ch
Fri Aug 6 19:01:27 EDT 2004
Update of /cvs-repository/Products/CMFDefault/skins/zpt_generic
In directory cvs.zope.org:/tmp/cvs-serv30138/skins/zpt_generic
Modified Files:
main_template.pt
Added Files:
permalink.py
Log Message:
- added a 'permalink' python script to be able to resolve content object by unique id by http://www.example.com/cmf_root/permalink/1234
=== Added File Products/CMFDefault/skins/zpt_generic/permalink.py ===
## Script (Python) "permalink"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=Returns an object by unique id
##
from Products.CMFCore.utils import getToolByName
uid_handler = getToolByName(context, 'portal_uidhandler')
obj = uid_handler.getObject(traverse_subpath[0])
portal_type = obj.getPortalTypeName()
ptypes = getToolByName(context, 'portal_types')
method = ptypes[portal_type].getActionById('view', None)
if method:
return getattr(obj, method)()
return obj()
=== Products/CMFDefault/skins/zpt_generic/main_template.pt 1.13 => 1.14 ===
--- Products/CMFDefault/skins/zpt_generic/main_template.pt:1.13 Tue Aug 3 09:33:04 2004
+++ Products/CMFDefault/skins/zpt_generic/main_template.pt Fri Aug 6 19:01:27 2004
@@ -4,6 +4,7 @@
mtool here/portal_membership;
atool here/portal_actions;
wtool here/portal_workflow;
+ uidtool here/portal_uidhandler | nothing;
portal_object utool/getPortalObject;
portal_title portal_object/Title;
object_title here/Title;
@@ -299,6 +300,16 @@
<!-- end main slot -->
</div>
+
+ <p tal:define="isFolderish here/isPrincipiaFolderish | nothing"
+ tal:condition="python: uidtool and not isFolderish">Permalink:
+ <a href=""
+ tal:define="uid python:uidtool.register(here);
+ url string:${portal_url}/permalink/${uid};"
+ tal:content="url"
+ tal:attributes="href url">
+ the unique id</a>
+ </p>
<!-- end Desktop -->
</div>
More information about the CMF-checkins
mailing list