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

chaouche yacine yacinechaouche at yahoo.com
Mon Sep 15 05:09:47 EDT 2008


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 ?



      


More information about the Zope mailing list