[Zope] List of dictionaries in ZPT

Chetan Kumar chetan@cdacindia.com
Fri, 11 Oct 2002 22:39:55 +0530


Hi all
I have a script that returns a list of dictionaries to a ZPT. I have=20
tried all I knew
without success in printing out the results in a table.

In the following ZPT the address at list should be visible. It does not !=
!

------------ZPT Start-------------------------
<table tal:define=3D"Empp python:request.AUTHENTICATED_USER">
<tbody tal:define=3D"Reps python:here.GetMyRecentDataPython">

<tr tal:content=3D"Reps">
</tr>

</tbody>
</table>
--------------ZPT End--------------------------

The script looks like
------------Script Start--------------------------
request =3D container.REQUEST
RESPONSE =3D request.RESPONSE

GotRecentData=3Dcontainer.GetMyRecentDataSQL(EmpID=3Drequest.EmpID).dicti=
onaries()

return GotRecentData
------------Script End-------------------------------

There are no issues with the SQL and Script. They provide just the right =

output
if tested seprately from ZPT.

I am struck. Here is the error message

------------------Error Message Start---------------


    Site Error

An error was encountered while publishing this resource.

*TALESError*

Sorry, a site error occurred.

Traceback (innermost last):
  File /home/sepg/Site2/lib/python/ZPublisher/Publish.py, line 150, in pu=
blish_module
  File /home/sepg/Site2/lib/python/Products/Localizer/__init__.py, line 6=
5, in new_publish
  File /home/sepg/Site2/lib/python/ZPublisher/Publish.py, line 114, in pu=
blish
  File /home/sepg/Site2/lib/python/Zope/__init__.py, line 158, in zpublis=
her_exception_hook
    (Object: My Recent Data)
  File /home/sepg/Site2/lib/python/ZPublisher/Publish.py, line 98, in pub=
lish
  File /home/sepg/Site2/lib/python/ZPublisher/mapply.py, line 88, in mapp=
ly
    (Object: index_html)
  File /home/sepg/Site2/lib/python/ZPublisher/Publish.py, line 39, in cal=
l_object
    (Object: index_html)
  File /home/sepg/Site2/lib/python/Shared/DC/Scripts/Bindings.py, line 25=
2, in __call__
    (Object: index_html)
  File /home/sepg/Site2/lib/python/Shared/DC/Scripts/Bindings.py, line 28=
3, in _bindAndExec
    (Object: index_html)
  File /home/sepg/Site2/lib/python/Products/PageTemplates/ZopePageTemplat=
e.py, line 207, in _exec
    (Object: index_html)
  File /home/sepg/Site2/lib/python/Products/PageTemplates/PageTemplate.py=
, line 86, in pt_render
    (Object: index_html)
    (Info: {'container': <Folder instance at 93dce58>,
 'here': <Folder instance at 93dce58>,
 'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter in=
stance at 0x869b764>,
 'nothing': None,
 'options': {'args': ()},
 'request': <h3>form</h3><table></table><h3>cookies</h3><table><tr valign=
=3D"top" align=3D"left"><th>__ac_name</th><td>'0530'</td></tr></table><h3=
>lazy items</h3><table><tr valign=3D"top" align=3D"left"><th>SESSION</th>=
<td>&lt;Python Method object at 0x8d350b8&gt;</td></tr></table><h3>other<=
/h3><table><tr valign=3D"top" align=3D"left"><th>AUTHENTICATION_PATH</th>=
<td>'ActivityWork'</td></tr><tr valign=3D"top" align=3D"left"><th>URL1</t=
h><td>'http://192.168.2.47:8080/ActivityWork/My%20Recent%20Data'</td></tr=
><tr valign=3D"top" align=3D"left"><th>PUBLISHED</th><td>&lt;ZopePageTemp=
late instance at 9318e58&gt;</td></tr><tr valign=3D"top" align=3D"left"><=
th>URL3</th><td>'http://192.168.2.47:8080'</td></tr><tr valign=3D"top" al=
ign=3D"left"><th>__ac_name</th><td>'0530'</td></tr><tr valign=3D"top" ali=
gn=3D"left"><th>BASE3</th><td>'http://192.168.2.47:8080/ActivityWork/My%2=
0Recent%20Data'</td></tr><tr valign=3D"top" align=3D"left"><th>URL2</th><=
td>'http://192.168.2.47:8080/ActivityWork'</td></tr><tr valign=3D"top" al=
ign=3D"left"><th>BASE1</th><td>'http://192.168.2.47:8080'</td></tr><tr va=
lign=3D"top" align=3D"left"><th>traverse_subpath</th><td>[]</td></tr><tr =
valign=3D"top" align=3D"left"><th>URL0</th><td>'http://192.168.2.47:8080/=
ActivityWork/My%20Recent%20Data/index_html'</td></tr><tr valign=3D"top" a=
lign=3D"left"><th>SERVER_URL</th><td>'http://192.168.2.47:8080'</td></tr>=
<tr valign=3D"top" align=3D"left"><th>BASE4</th><td>'http://192.168.2.47:=
8080/ActivityWork/My%20Recent%20Data/index_html'</td></tr><tr valign=3D"t=
op" align=3D"left"><th>USER_PREF_LANGUAGES</th><td>&lt;Products.Localizer=
=2EAcceptLanguage.AcceptLanguage instance at 0x9ad6934&gt;</td></tr><tr v=
align=3D"top" align=3D"left"><th>URL</th><td>'http://192.168.2.47:8080/Ac=
tivityWork/My%20Recent%20Data/index_html'</td></tr><tr valign=3D"top" ali=
gn=3D"left"><th>BASE2</th><td>'http://192.168.2.47:8080/ActivityWork'</td=
></tr><tr valign=3D"top" align=3D"left"><th>TraversalRequestNameStack</th=
><td>[]</td></tr><tr valign=3D"top" align=3D"left"><th>AUTHENTICATED_USER=
</th><td>0530</td></tr><tr valign=3D"top" align=3D"left"><th>BASE0</th><t=
d>'http://192.168.2.47:8080'</td></tr><tr valign=3D"top" align=3D"left"><=
th>URL0</th><td>http://192.168.2.47:8080/ActivityWork/My%20Recent%20Data/=
index_html</td></tr><tr valign=3D"top" align=3D"left"><th>URL1</th><td>ht=
tp://192.168.2.47:8080/ActivityWork/My%20Recent%20Data</td></tr><tr valig=
n=3D"top" align=3D"left"><th>URL2</th><td>http://192.168.2.47:8080/Activi=
tyWork</td></tr><tr valign=3D"top" align=3D"left"><th>URL3</th><td>http:/=
/192.168.2.47:8080</td></tr><tr valign=3D"top" align=3D"left"><th>BASE0</=
th><td>http://192.168.2.47:8080</td></tr><tr valign=3D"top" align=3D"left=
"><th>BASE1</th><td>http://192.168.2.47:8080</td></tr><tr valign=3D"top" =
align=3D"left"><th>BASE2</th><td>http://192.168.2.47:8080/ActivityWork</t=
d></tr><tr valign=3D"top" align=3D"left"><th>BASE3</th><td>http://192.168=
=2E2.47:8080/ActivityWork/My%20Recent%20Data</td></tr><tr valign=3D"top" =
align=3D"left"><th>BASE4</th><td>http://192.168.2.47:8080/ActivityWork/My=
%20Recent%20Data/index_html</td></tr></table><h3>environ</h3><table><tr v=
align=3D"top" align=3D"left"><th>HTTP_KEEP_ALIVE</th><td>'300'</td></tr><=
tr valign=3D"top" align=3D"left"><th>HTTP_ACCEPT_ENCODING</th><td>'gzip, =
deflate, compress;q=3D0.9'</td></tr><tr valign=3D"top" align=3D"left"><th=
>channel.creation_time</th><td>1034356075</td></tr><tr valign=3D"top" ali=
gn=3D"left"><th>SERVER_PROTOCOL</th><td>'HTTP/1.1'</td></tr><tr valign=3D=
"top" align=3D"left"><th>SERVER_PORT</th><td>'8080'</td></tr><tr valign=3D=
"top" align=3D"left"><th>PATH_INFO</th><td>'/ActivityWork/My Recent Data'=
</td></tr><tr valign=3D"top" align=3D"left"><th>HTTP_HOST</th><td>'192.16=
8.2.47:8080'</td></tr><tr valign=3D"top" align=3D"left"><th>REQUEST_METHO=
D</th><td>'GET'</td></tr><tr valign=3D"top" align=3D"left"><th>PATH_TRANS=
LATED</th><td>'/ActivityWork/My Recent Data'</td></tr><tr valign=3D"top" =
align=3D"left"><th>HTTP_COOKIE</th><td>'__ac=3D"MDUzMDpwbG8wOTg%3D%0A"; _=
_ac_name=3D"0530"'</td></tr><tr valign=3D"top" align=3D"left"><th>SCRIPT_=
NAME</th><td>''</td></tr><tr valign=3D"top" align=3D"left"><th>SERVER_SOF=
TWARE</th><td>'Zope/(Zope 2.5.0 (binary release, python 2.1, linux2-x86),=
 python 2.1.3, linux2) ZServer/1.1b1'</td></tr><tr valign=3D"top" align=3D=
"left"><th>HTTP_ACCEPT_LANGUAGE</th><td>'en-us, en;q=3D0.50'</td></tr><tr=
 valign=3D"top" align=3D"left"><th>HTTP_ACCEPT</th><td>'text/xml,applicat=
ion/xml,application/xhtml+xml,text/html;q=3D0.9,text/plain;q=3D0.8,video/=
x-mng,image/png,image/jpeg,image/gif;q=3D0.2,text/css,*/*;q=3D0.1'</td></=
tr><tr valign=3D"top" align=3D"left"><th>REMOTE_ADDR</th><td>'192.168.2.4=
7'</td></tr><tr valign=3D"top" align=3D"left"><th>HTTP_REFERER</th><td>'h=
ttp://192.168.2.47:8080/ActivityWork/My%20Recent%20Data'</td></tr><tr val=
ign=3D"top" align=3D"left"><th>SERVER_NAME</th><td>'eddy'</td></tr><tr va=
lign=3D"top" align=3D"left"><th>GATEWAY_INTERFACE</th><td>'CGI/1.1'</td><=
/tr><tr valign=3D"top" align=3D"left"><th>HTTP_USER_AGENT</th><td>'Mozill=
a/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826'</td></tr><tr va=
lign=3D"top" align=3D"left"><th>HTTP_ACCEPT_CHARSET</th><td>'ISO-8859-1, =
utf-8;q=3D0.66, *;q=3D0.66'</td></tr><tr valign=3D"top" align=3D"left"><t=
h>CONNECTION_TYPE</th><td>'keep-alive'</td></tr></table>,
 'root': <Application instance at 9016250>,
 'template': <ZopePageTemplate instance at 9318e58>,
 'traverse_subpath': [],
 'user': 0530})
  File /home/sepg/Site2/lib/python/TAL/TALInterpreter.py, line 158, in __=
call__
  File /home/sepg/Site2/lib/python/TAL/TALInterpreter.py, line 191, in in=
terpret
  File /home/sepg/Site2/lib/python/TAL/TALInterpreter.py, line 523, in do=
_useMacro
  File /home/sepg/Site2/lib/python/TAL/TALInterpreter.py, line 191, in in=
terpret
  File /home/sepg/Site2/lib/python/TAL/TALInterpreter.py, line 542, in do=
_defineSlot
  File /home/sepg/Site2/lib/python/TAL/TALInterpreter.py, line 191, in in=
terpret
  File /home/sepg/Site2/lib/python/TAL/TALInterpreter.py, line 491, in do=
_condition
  File /home/sepg/Site2/lib/python/TAL/TALInterpreter.py, line 191, in in=
terpret
  File /home/sepg/Site2/lib/python/TAL/TALInterpreter.py, line 413, in do=
_insertText_tal
  File /home/sepg/Site2/lib/python/Products/PageTemplates/TALES.py, line =
269, in evaluateText
  File /home/sepg/Site2/lib/python/Products/PageTemplates/TALES.py, line =
247, in evaluate
  File /home/sepg/Site2/lib/python/Products/PageTemplates/Expressions.py,=
 line 189, in __call__
  File /home/sepg/Site2/lib/python/Products/PageTemplates/Expressions.py,=
 line 184, in _eval
  File /home/sepg/Site2/lib/python/Products/PageTemplates/Expressions.py,=
 line 84, in render
    (Object: GetMyRecentDataPython)
  File /home/sepg/Site2/lib/python/Products/PageTemplates/ZRPythonExpr.py=
, line 75, in call_with_ns
    (Object: __render_with_namespace__)
  File /home/sepg/Site2/lib/python/Shared/DC/Scripts/Bindings.py, line 26=
6, in __render_with_namespace__
    (Object: GetMyRecentDataPython)
  File /home/sepg/Site2/lib/python/Shared/DC/Scripts/Bindings.py, line 28=
3, in _bindAndExec
    (Object: GetMyRecentDataPython)
  File /home/sepg/Site2/lib/python/Products/PythonScripts/PythonScript.py=
, line 291, in _exec
    (Object: GetMyRecentDataPython)
    (Info: ({'script': <PythonScript instance at 9ac1318>, 'context': <Fo=
lder instance at 93dce58>, 'container': <Folder instance at 93dce58>, 'tr=
averse_subpath': []}, (), {}, None))
TALESError: Sorry, an error occurred

------------------Errot Message End----------------



TIA
Chetan