[Zope] Security problem when accessing object instance in a product

Nicolas Évrard nicoe@wanadoo.be
Sat, 31 Aug 2002 13:50:34 +0200


--oyUTqETQ0mS9luUI
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello,

I'm currently working on Maildir product which may provide access to my
mails.

I've defined a class to access this maildir :

from Maildirlib import Maildir
class ZMaildir(Implicit, Persistent, RoleManager, Item) :
    """ Classe impl=E9mentant un composant Maildir """

    meta_type =3D 'ZMaildir'
    security =3D ClassSecurityInfo()

    def __init__(self, id, path) :
        self.id =3D id
        self.path =3D path
        self._messages =3D {}
        self._populate()

    security.declareProtected('View content', 'GetMailList')
    def GetMailList(self) :
        """ Retourne la liste des mails """
        lst =3D []
        for i in self._messages.keys() : lst.append(self._messages[i])
        return lst

    def _populate(self) :
        maildir =3D Maildir(self.path)
        mail_p =3D maildir.next()
        while mail_p :
            self._messages[mail_p.msgID] =3D mail_p
            mail_p =3D maildir.next()
            self._p_changed =3D 1

GetMailList returns the right list with some Maildir.Message in it.

When I try to access the Maildir.Message.headers variable I've got this
error :

You are not allowed to access headers in this context

but I have declared headers public :

class Message :
       =20
      security =3D ClassSecurityInfo()
      security.declarePublic('headers')

Here is the way I try to access headers :

http://localhost:9673/nicoe/voir_mail/inbox/voir_maillist
where voir_maillist is a ZPT with
<TR tal:repeat=3D"item here/GetMailList">
 <TD tal:content=3D"item/headers/from">From</TD>
 <TD tal:content=3D"item/headers/to">To</TD>
 <TD tal:content=3D"item/headers/subject">Sujet</TD>
</TR>


Sorry for the long explanation, I hope I don't polute too much the list ...
--=20
(=B0>  Nicolas =C9vrard
/ )  Li=E8ge - Belgique
^^

--oyUTqETQ0mS9luUI
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9cK2K1fJ5cz1/+2URAn2XAKDVDvp5bvBuJcz9wUv/ppyDA+KbhwCfTADi
C3CcwdWy7QNsy3s4LHErqac=
=4/7+
-----END PGP SIGNATURE-----

--oyUTqETQ0mS9luUI--