Re[2]: [Zope] Lookinf inside page templates from a script

Dmitry Matveev Dmitry Matveev <matveev@uralfirm.ru>
Tue, 13 Aug 2002 17:41:15 +0600


DM> Felix Ulrich-Oltean writes:
DM>  > In PageTemplate.py, I have found pt_macros(), which returns a
DM>  > dictionary with macro names as keys.  Great so far.  I can even print
DM>  > pt_macros() and get a string representing the whole dictionary.
DM>  > However, when I try to access the corresponding value so I can look
DM>  > for the slots inside each macro, I get the error shown below.
DM>  > ...
DM>  > Error Type: TypeError
DM>  > Error Value: unsubscriptable object

for key, value in context.main_template.pt_macros().items():
  print key
  print value
return printed
It works.

-- 
Best regards,                          www.uralfirm.ru
Dmitry Matveev                         mailto:matveev@uralfirm.ru