Better traceback information in DTML

Bug #143788 reported by pooryorick
2
Affects Status Importance Assigned to Milestone
Zope 2
Invalid
Medium
Unassigned

Bug Description

when accessing control panel via http://zope_url/Control_Panel/manage_workspace:

Traceback (innermost last):

    * Module ZPublisher.Publish, line 187, in publish_module_standard
    * Module ZPublisher.Publish, line 144, in publish
    * Module Zope2.App.startup, line 199, in zpublisher_exception_hook
    * Module ZPublisher.Publish, line 113, in publish
    * Module ZPublisher.mapply, line 88, in mapply
    * Module ZPublisher.Publish, line 40, in call_object
    * Module Shared.DC.Scripts.Bindings, line 311, in __call__
    * Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
    * Module App.special_dtml, line 175, in _exec
    * Module Shared.DC.Scripts.Bindings, line 325, in __render_with_namespace__
    * Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
    * Module App.special_dtml, line 175, in _exec
    * Module DocumentTemplate.DT_Util, line 196, in eval
      __traceback_info__: RESPONSE
    * Module <string>, line 0, in ?

Tags: bug zope
Revision history for this message
pooryorick (pooryorick) wrote :

...
AttributeError: 'NoneType' object has no attribute 'setHeader' (Also, an error occurred while attempting to render the standard error message.)

Revision history for this message
pooryorick (pooryorick) wrote :

This occurs when I am logged in as a user without manager or owner permissions to control panel. top-level acl_users has been replaced by Product
LDAPUserFolder (Installed product LDAPUserFolder (2.5beta1))

Revision history for this message
Patrick Gerken (do3cc) wrote :

Hello pooryorick,

you hit a classic there, the bug is actually not so new. But it is a bit hard to track.
I looked a bit into the possibilities to generate better traceback information.
With some luck I can create a patch for you that will result in more exact information, where exactly your site breaks.
The next step would be to analyse why you got a NoneType Error, with some luck I can see that by analysing the extended traceback if not, it would be bad :-(
Is your zope server a system in production or is it something where debugging can take place?

Revision history for this message
Patrick Gerken (do3cc) wrote :

Hello pooryorick,

please have a look at this.
I did this changes to a new version of zope, but it should be easy to apply to your setup.
Look, which file I edited, look where you must add the line denoted by the plus, and try to ignore the exact line number.
With these three entries we should now where exactly the stuff is breaking.

Index: DocumentTemplate/DT_Util.py
===================================================================
--- DocumentTemplate/DT_Util.py (Revision 70379)
+++ DocumentTemplate/DT_Util.py (Arbeitskopie)
@@ -193,6 +193,7 @@
                 # might not actually need the name. If it
                 # does need the name, a NameError will occur.
                 pass
+ __traceback_info__ = self.expr
         return eval(code, d)

     def __call__(self, **kw):
Index: DocumentTemplate/DT_Let.py
===================================================================
--- DocumentTemplate/DT_Let.py (Revision 70379)
+++ DocumentTemplate/DT_Let.py (Arbeitskopie)
@@ -71,6 +71,7 @@
         d={}; md._push(d)
         try:
             for name,expr in self.args:
+ __traceback_info__ = self.__name__
                 if type(expr) is type(''): d[name]=md[expr]
                 else: d[name]=expr(md)
             return render_blocks(self.section, md)
Index: App/special_dtml.py
===================================================================
--- App/special_dtml.py (Revision 70379)
+++ App/special_dtml.py (Arbeitskopie)
@@ -175,6 +175,7 @@
         try:
             value = self.ZDocumentTemplate_beforeRender(ns, _marker)
             if value is _marker:
+ __traceback_info__ = self.raw
                 try: result = render_blocks(self._v_blocks, ns)
                 except DTReturn, v: result = v.v
                 except AttributeError:

Revision history for this message
Hanno Schlichting (hannosch) wrote :

There's a good patch here, even though the original report is likely incomplete.

Changed in zope2:
status: New → Confirmed
summary: - 'NoneType' object has no attribute 'setHeader'
+ Better traceback information in DTML
Revision history for this message
Colin Watson (cjwatson) wrote :

The zope2 project on Launchpad has been archived at the request of the Zope developers (see https://answers.launchpad.net/launchpad/+question/683589 and https://answers.launchpad.net/launchpad/+question/685285). If this bug is still relevant, please refile it at https://github.com/zopefoundation/zope2.

Changed in zope2:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.