[Zope] 'str' object has no attribute 'other'

chaouche yacine yacinechaouche at yahoo.com
Tue Sep 16 00:14:20 EDT 2008


Aha ! good point. I'll try that as soon as I get to work.

Thank you.

Marco, I'm using zope 2.7, python 2.3 (this is customer's configuration).







--- On Mon, 9/15/08, Martijn Jacobs <martijn at fourdigits.nl> wrote:

> From: Martijn Jacobs <martijn at fourdigits.nl>
> Subject: Re: [Zope] 'str' object has no attribute 'other'
> To: yacinechaouche at yahoo.com
> Cc: "zope zope" <zope at zope.org>
> Date: Monday, September 15, 2008, 2:46 PM
> I think it has something to do with the PageTemplate not
> properly 
> (explicit) acquiition wrapped .
> 
> Try changing the line :
> userProfile =
> PageTemplateFile("views/userProfile.pt",globals())
> 
> into :
> userProfile = 
> PageTemplateFile("views/userProfile.pt",globals()).__of__(self)
> 
> 
> See for more information :
> 
> http://www.zopelabs.com/cookbook/995992579
> 
> 
> Regards,
> 
> 
> Martijn.
> > HAI list,
> >
> > I am developing a zope product composed of a bunch of
> python classes, some which are instanciated in the ZODB,
> like plone's tools, and some that are just helper
> classes, they do not need to be instanciated in the ZODB.
> >
> > UserManager is a class that is in the ZODB.
> UserManager retrieves users from MySQL, and create User
> objects. User is a classic python class (that is not
> instanciated in the ZODB). 
> >
> > For every user, i wish to display its profile on the
> site using a Page Template. So I tried something like this :
> >
> > from Products.PageTemplates.PageTemplateFile import
> PageTemplateFile
> > from AccessControl                           import
> ClassSecurityInfo
> > from Utilisateur                             import
> Utilisateur
> > import Globals
> >
> > class User() :
> >     security = ClassSecurityInfo()
> >     security.declareObjectPublic()
> >     security.setDefaultAccess("allow")
> >
> >     userProfile =
> PageTemplateFile("views/userProfile.pt",globals())
> >     
> >     ...
> >
> > Globals.InitializeClass(User)
> >
> >
> > Then, in UserManager, I have another Page Template
> that displays a user profile this way :
> >
> > <html>
> > <body>
> >   <h1>User profile </h1>
> >   <hr/>
> >   <ins tal:define="myUser
> request/SESSION/myUser"
> tal:replace="myUser/userProfile"
> > </body>
> > </html>
> >
> >
> > This code produces the following error : 
> >
> >
> > Module ZPublisher.Publish, line 101, in publish
> > Module ZPublisher.mapply, line 88, in mapply
> > Module ZPublisher.Publish, line 39, in call_object
> > ...
> > Module Shared.DC.Scripts.Bindings, line 1, in ?
> > Module Shared.DC.Scripts.Bindings, line 286, in
> _getTraverseSubpath
> > AttributeError: 'str' object has no attribute
> 'other'
> >
> >
> > Any ideas ?
> >
> >
> >
> >       
> > _______________________________________________
> > Zope maillist  -  Zope at zope.org
> > http://mail.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists - 
> >  http://mail.zope.org/mailman/listinfo/zope-announce
> >  http://mail.zope.org/mailman/listinfo/zope-dev )
> >   
> 
> 
> -- 
> Martijn Jacobs
> Four Digits, Internet Solutions
> 
> a: Willemsplein 15-1 6811 KB Arnhem NL 
> kvk: 091621370000 | btw: 8161.22.234.B01
> e-mail: martijn at fourdigits.nl | web:
> http://www.fourdigits.nl
> tel: +31 (0)26 44 22 700 | fax: +31 (0)84 22 06 117


      


More information about the Zope mailing list