I've run into a bug with <dtml-try/except> with Zope 2.2.0b3.

I have a folder called 'root' that looks like this:

  one (folder)
  two (folder)
  three (folder)
  a_one (dtml method)
  a_two (dtml method)
  index_html (dtml method)

index_html looks like this:

      <dtml-var "_.getitem('a_%s' % id, 1)">
  <dtml-except KeyError>
      Here goes default information.

The idea is to do the following:

http://.../root/one      -->     invoke root/a_one
http://.../root/two      -->     invoke root/a_two
http://.../root/one/two  -->     invoke root/a_two
http://.../root/two/one  -->     invoke root/a_one
http://.../root/three    -->     "Here goes default information."
http://.../root          -->     "Here goes default information."

I'm rendering the folders under root (one, two, three, ...) with 
<dtml-tree>; I want to reconfigure my tree easily while keeping the 
leaves' content in one place, i.e., in a_one, a_two, etc. in root.

The above works with Zope-2.1.6 but not with Zope-2.2.0b3.

Here's the traceback:

Zope has encountered an error while publishing this resource. 

             Error Type: TypeError
             Error Value: unexpected keyword argument: error_type

Traceback (innermost last):
  File C:\pkg\Zope220b3\lib\python\ZPublisher\Publish.py, line 222, in publish_module
  File C:\pkg\Zope220b3\lib\python\ZPublisher\Publish.py, line 187, in publish
  File C:\pkg\Zope220b3\lib\python\Zope\__init__.py, line 221, in 
    (Object: ElementWithAttributes)
  File C:\pkg\Zope220b3\lib\python\ZPublisher\Publish.py, line 171, in publish
  File C:\pkg\Zope220b3\lib\python\ZPublisher\mapply.py, line 160, in mapply
    (Object: index_html)
  File C:\pkg\Zope220b3\lib\python\ZPublisher\Publish.py, line 112, in call_object
    (Object: index_html)
  File C:\pkg\Zope220b3\lib\python\OFS\DTMLMethod.py, line 167, in __call__
    (Object: index_html)
  File C:\pkg\Zope220b3\lib\python\DocumentTemplate\DT_String.py, line 502, in __call__
    (Object: index_html)
  File C:\pkg\Zope220b3\lib\python\DocumentTemplate\DT_Try.py, line 212, in render
  File C:\pkg\Zope220b3\lib\python\DocumentTemplate\DT_Try.py, line 244, in 
  File C:\pkg\Zope220b3\lib\python\DocumentTemplate\DT_Util.py, line 262, in namespace
TypeError: (see above)

Traceback says the problem is at DocumentTemplate.DT_Util.namespace().
The 2.1.6 and 2.2.0b3 implementations are different. Plugging in 2.1.6's
code fixes _this_ problem:

def namespace(self, **kw):
    """Create a tuple consisting of a single instance whos attributes are
    provided as keyword arguments."""
    #return apply(self, (), kw)
    # XXX ngps - following is the 2.1.6 implementation
    for k, v in kw.items(): d[k]=v
    return r,


Ng Pheng Siong <[EMAIL PROTECTED]> * http://www.post1.com/home/ngps

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to