[Zope] dtml access to the instance data

Andrey V Khavryutchenko akhavr@compchem.kiev.ua
02 Apr 1999 13:08:32 +0300


Hi!

I'm having strange problems with simple dtml example:

===== test.py
# -*- python -*- file
# $Id$
#
# Copyright (C) 1999 by Andrey V Khavryutchenko <akhavr@compchem.kiev.ua>

import DocumentTemplate

class Test:
    title = 'Test page'
    index_html = DocumentTemplate.HTMLFile('test.dtml')

t = Test()
print t.index_html()

===== test.dtml
<html>
  <head><title><!--#var head--></title></head>
  <body>
  <p>This is a test
  </body>
</html>

[akhavr@netmaster] ZTemplates-2.3.0$ python test.py
Traceback (innermost last):
  File "test.py", line 13, in ?
    print t.index_html()
  File "DocumentTemplate/DT_String.py", line 514, in __call__
    return render_blocks(self.blocks,md)
  File "DocumentTemplate/pDocumentTemplate.py", line 244, in render_blocks
    if type(section) is StringType: section=md[section]
  File "DocumentTemplate/pDocumentTemplate.py", line 209, in __getitem__
    v=self.dicts[key]
  File "DocumentTemplate/pDocumentTemplate.py", line 178, in __getitem__
    raise KeyError, key
KeyError: head

Obviously, I do not understand some fundamentals.  Can anyone give me a
hint?

TIA.

-- 
SY, Andrey V Khavryutchenko	http://www.kbi.kiev.ua/~akhavr

Shick's Law:
	There is no problem a good miracle can't solve.