AttributeError: level in App/special_dtml.py using ZPublisher.Zope method

Bug #143261 reported by Juan Antonio Valiño on 2004-12-16
2
Affects Status Importance Assigned to Milestone
Zope 2
Low
Unassigned

Bug Description

I created a page template (called 'form') with this content:

<h1 tal:replace="structure here/manage_page_header">Header</h1>
<p>Hello World</p>
<h1 tal:replace="structure here/manage_page_footer">Footer</h1>

Testing this page template from browser works ok, but if I use ZPublisher.Zope('/form') method within an unit test an exception is raised:

Traceback (most recent call last):
  File "/home/jvg/opt/zope-2.8.0-a1/lib/python/ZPublisher/Publish.py", line 113, in publish
    request, bind=1)
  File "/home/jvg/opt/zope-2.8.0-a1/lib/python/ZPublisher/mapply.py", line 88, in mapply
    if debug is not None: return debug(object,args,context)
  File "/home/jvg/opt/zope-2.8.0-a1/lib/python/ZPublisher/Publish.py", line 40, in call_object
    result=apply(object,args) # Type s<cr> to step into published object.
  File "/home/jvg/opt/zope-2.8.0-a1/lib/python/Shared/DC/Scripts/Bindings.py", line 306, in __call__
    return self._bindAndExec(args, kw, None)
  File "/home/jvg/opt/zope-2.8.0-a1/lib/python/Shared/DC/Scripts/Bindings.py", line 343, in _bindAndExec
    return self._exec(bound_data, args, kw)
  File "/home/jvg/opt/zope-2.8.0-a1/lib/python/Products/PageTemplates/ZopePageTemplate.py", line 256, in _exec
    result = self.pt_render(extra_context=bound_names)
  File "/home/jvg/opt/zope-2.8.0-a1/lib/python/Products/PageTemplates/PageTemplate.py", line 102, in pt_render
    tal=not source, strictinsert=0)()
  File "/home/jvg/opt/zope-2.8.0-a1/lib/python/TAL/TALInterpreter.py", line 190, in __call__
    self.interpret(self.program)
  File "/home/jvg/opt/zope-2.8.0-a1/lib/python/TAL/TALInterpreter.py", line 234, in interpret
    handlers[opcode](self, args)
  File "/home/jvg/opt/zope-2.8.0-a1/lib/python/TAL/TALInterpreter.py", line 569, in do_insertStructure_tal
    structure = self.engine.evaluateStructure(expr)
  File "/home/jvg/opt/zope-2.8.0-a1/lib/python/Products/PageTemplates/TALES.py", line 221, in evaluate
    return expression(self)
  File "/home/jvg/opt/zope-2.8.0-a1/lib/python/Products/PageTemplates/Expressions.py", line 201, in __call__
    return self._eval(econtext)
  File "/home/jvg/opt/zope-2.8.0-a1/lib/python/Products/PageTemplates/Expressions.py", line 196, in _eval
    return render(ob, econtext.vars)
  File "/home/jvg/opt/zope-2.8.0-a1/lib/python/Products/PageTemplates/Expressions.py", line 95, in render
    ob = call_with_ns(ob.__render_with_namespace__, ns)
  File "/home/jvg/opt/zope-2.8.0-a1/lib/python/Products/PageTemplates/Expressions.py", line 75, in call_with_ns
    return f(ns)
  File "/home/jvg/opt/zope-2.8.0-a1/lib/python/Shared/DC/Scripts/Bindings.py", line 320, in __render_with_namespace__
    return self._bindAndExec((), namevals, namespace)
  File "/home/jvg/opt/zope-2.8.0-a1/lib/python/Shared/DC/Scripts/Bindings.py", line 343, in _bindAndExec
    return self._exec(bound_data, args, kw)
  File "/home/jvg/opt/zope/lib/python/App/special_dtml.py", line 127, in _exec
    ns.level = cns.level + 1
AttributeError: level

It seems that testing machinery is broken.

Andreas Jung (ajung) wrote :

Changes: submitter email, importance (critical => medium)

The old ZPublisher.Zope machinery can now be found under Zope2.debug. It has indeed been broken, but in a different way. With the fix linked below the page template described by the original poster can be executed fine using Zope2.debug.

Zope 2.12 branch: http://svn.zope.org/Zope/trunk/src/ZPublisher/?rev=112687&view=rev

Zope trunk: http://svn.zope.org/Zope/trunk/src/ZPublisher/?rev=112688&view=rev

Changed in zope2:
assignee: nobody → Jens Vagelpohl (jens-dataflake)
importance: Medium → Low
status: New → Confirmed
milestone: none → 2.12.7
status: Confirmed → Fix Committed
Changed in zope2:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers