Commit 171402f7 authored by Evan Simpson's avatar Evan Simpson

Provide traceback supplements for DTML Methods and Documents.

parent 48728f92
......@@ -8,6 +8,8 @@ Zope Changes
Features added
- DTML Methods and Documents supply a traceback supplement when called.
- OFS: OrderSupport and OrderedFolder added. OrderSupport is a mixin class
that adds the IOrderedContainer interface to ObjectManagers.
OrderedFolder - meta_type 'Folder (Ordered)' - is a new Folder class
......
......@@ -12,7 +12,7 @@
##############################################################################
"""DTML Document objects."""
__version__='$Revision: 1.49 $'[11:-2]
__version__='$Revision: 1.50 $'[11:-2]
from ZPublisher.Converters import type_converters
from Globals import HTML, DTMLFile, MessageDialog
......@@ -26,6 +26,7 @@ from sgmllib import SGMLParser
from urllib import quote
import Globals
from AccessControl import getSecurityManager
from zExceptions.TracebackSupplement import PathTracebackSupplement
done='done'
......@@ -109,6 +110,7 @@ class DTMLDocument(PropertyManager, DTMLMethod):
# Return cached results.
return data
__traceback_supplement__ = (PathTracebackSupplement, self)
kw['document_id'] =self.getId()
kw['document_title']=self.title
if hasattr(self, 'aq_explicit'):
......
......@@ -12,7 +12,7 @@
##############################################################################
"""DTML Method objects."""
__version__='$Revision: 1.81 $'[11:-2]
__version__='$Revision: 1.82 $'[11:-2]
import History
from Globals import HTML, DTMLFile, MessageDialog
......@@ -30,6 +30,7 @@ import Globals, sys, Acquisition
from AccessControl import getSecurityManager
from AccessControl.DTML import RestrictedDTML
from Cache import Cacheable
from zExceptions.TracebackSupplement import PathTracebackSupplement
_marker = [] # Create a new marker object.
......@@ -102,6 +103,7 @@ class DTMLMethod(RestrictedDTML, HTML, Acquisition.Implicit, RoleManager,
# Return cached results.
return data
__traceback_supplement__ = (PathTracebackSupplement, self)
kw['document_id'] =self.getId()
kw['document_title']=self.title
......
# Stock __traceback_supplement__ implementations
class PathTracebackSupplement:
"""Implementation of ITracebackSupplement"""
pp = None
def __init__(self, object):
self.object = object
if hasattr(object, 'getPhysicalPath'):
self.pp = '/'.join(object.getPhysicalPath())
if hasattr(object, 'absolute_url'):
self.source_url = '%s/manage_main' % object.absolute_url()
def getInfo(self, as_html=0):
if self.pp is None:
return
if as_html:
from cgi import escape
return '<b>Physical Path:</b>%s' % (escape(self.pp))
else:
return ' - Physical Path: %s' % self.pp
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment