[Zope3-Users] can't seem to get data from proxied database rows

matt wilbert matt.wilbert at gmail.com
Mon Mar 21 23:50:27 EST 2005


Thanks for your help.  Unfortunately I haven't managed to link a
filesystem package to a database adapter yet.  I'm working on it
though.

Matt


On Mon, 21 Mar 2005 07:39:37 +0100, Dominik Huber
<dominik.huber at projekt01.ch> wrote:
> matt wilbert wrote:
> 
> >I have a database connection to a mysql database from ZopeX3.  It
> >works (I can run test
> >queries), and I have created a minimal Sql Script ("select * from
> >test'") which also works when I test it.  It is called "listPeople"
> >
> >Now I try to use it from a ZPT that looks like this:
> >
> ><table tal:repeat="name context/listPeople">
> >  <tr tal:replace="python:name">Name</tr>
> ></table>
> >
> >I get a result that looks like:
> >
> ><security proxied zope.app.rdb.GeneratedRowClass instance at 0x2a9b1d95a8>
> ><security proxied zope.app.rdb.GeneratedRowClass instance at 0x2a9b1d94d0>
> ><security proxied zope.app.rdb.GeneratedRowClass instance at 0x2a9b1d9f38>
> >
> >which makes sense because there are three rows in the test table.
> >
> >However, I can't figure out how to get at the data.  Any attempt to
> >reference something inside
> >the proxied objects  (like "python:name[0]" or
> >"python:name['lastname']" gives me a ForbiddenAttribute error.  Is
> >this something I can't do with a TTW ZPT, or am I missing something
> >more straightforward.  I have granted all possible permissions to
> >Everybody.
> >
> >
> No, you have prsumably to register your People class as zope:class or
> zope:content within zcml too:
> 
> for example:
> 
>   <content class="yourpacke.People">
>     <require
>         permission="zope.View"
>         interface="yourpacke.IPeople"
>         />
>     <require
>         permission="zope.ManageContent"
>         set_schema="yourpacke.IPeople"
>         />
>   </content>
> 
> see for details:
> http://localhost:8080/++apidoc++/ZCML/http_co__sl__sl_namespaces.zope.org_sl_zope/class/index.html
> http://localhost:8080/++apidoc++/ZCML/http_co__sl__sl_namespaces.zope.org_sl_zope/content/index.html
> 
> >Thanks,
> >
> >Matt Wilbert
> >_______________________________________________
> >Zope3-users mailing list
> >Zope3-users at zope.org
> >http://mail.zope.org/mailman/listinfo/zope3-users
> >
> >
> >
> >
> 
>


More information about the Zope3-users mailing list