[Zope3-checkins] CVS: Zope3/src/zope/app/site/browser - tools.py:1.2
Stephan Richter
srichter at cosmos.phy.tufts.edu
Sun Mar 21 12:09:42 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/site/browser
In directory cvs.zope.org:/tmp/cvs-serv18554/src/zope/app/site/browser
Modified Files:
tools.py
Log Message:
Implemented ToolBacklink view for tool backlink generation.
=== Zope3/src/zope/app/site/browser/tools.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/site/browser/tools.py:1.1 Sun Mar 21 11:02:24 2004
+++ Zope3/src/zope/app/site/browser/tools.py Sun Mar 21 12:09:41 2004
@@ -23,19 +23,8 @@
from zope.app import zapi
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
from zope.app.site.folder import SiteManagementFolder
+from zope.app.servicenames import Services
-class ToolsOverview:
- def getTools(self):
- tools = []
- for n, iface in zapi.getUtilitiesFor(None, IToolType):
- name = iface.getName()
- view = zapi.getView(self.context, 'manage%sTool.html' % name,
- self.request)
- tools.append({'title':view.title,
- 'description':view.description,
- 'action':'./@@manage%sTool.html' % name })
- return tools
-
class IToolType(IInterface):
"""Interfaces implementing the tool type are considered tools."""
@@ -66,6 +55,27 @@
interface = Attribute("Interface the utility provides.")
+class ToolsOverview:
+ def getTools(self):
+ tools = []
+ for n, iface in zapi.getUtilitiesFor(None, IToolType):
+ name = iface.getName()
+ view = zapi.getView(self.context, 'manage%sTool.html' % name,
+ self.request)
+ tools.append({'title':view.title,
+ 'description':view.description,
+ 'action':'./@@manage%sTool.html' % name })
+ return tools
+
+class ToolsBacklink:
+ def getLink(self):
+ service = zapi.getService(self.context, Services)
+ iface = zapi.queryType(self.context, IToolType)
+ url = '%s/manage%sTool.html' %(zapi.getPath(service), iface.getName())
+
+ return self.request.response.redirect(url)
+
+
class UtilityToolsView(SimpleView):
"""Tools view for utilities."""
More information about the Zope3-Checkins
mailing list