[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services - field.py:1.7
Jim Fulton
jim@zope.com
Fri, 21 Mar 2003 15:59:25 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser/services
In directory cvs.zope.org:/tmp/cvs-serv18601/src/zope/app/browser/services
Modified Files:
field.py
Log Message:
Added a component path display widget that just displays the component
path for a configuration.
=== Zope3/src/zope/app/browser/services/field.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/browser/services/field.py:1.6 Fri Feb 21 09:53:34 2003
+++ Zope3/src/zope/app/browser/services/field.py Fri Mar 21 15:59:24 2003
@@ -19,11 +19,12 @@
from zope.app.browser.form.widget import BrowserWidget
from zope.app.interfaces.browser.form import IBrowserWidget
-from zope.component import getServiceManager
+from zope.component import getServiceManager, getView
from zope.app.form.widget import Widget
from zope.publisher.browser import BrowserView
from xml.sax.saxutils import quoteattr
from zope.app.interfaces.form import WidgetInputError
+from zope.app.traversing import traverse, canonicalPath
class ComponentPathWidget(BrowserWidget):
@@ -40,7 +41,18 @@
def __call__(self):
selected = self._showData()
field = self.context
- return renderPathSelect(field.context, field.type, self.name, selected)
+ return renderPathSelect(field.context, field.type,
+ self.name, selected)
+
+class ComponentPathDisplayWidget(ComponentPathWidget):
+
+ def __call__(self):
+ path = self._showData()
+ path = canonicalPath(path)
+ ob = traverse(self.context.context, path)
+ url = str(getView(ob, 'absolute_url', self.request))
+ url += "/@@SelectedManagementView.html"
+ return '<a href="%s">%s</a>' % (url, path)
class ComponentLocationWidget(Widget, BrowserView):