[Zope3-dev] Problem with content object attributes and DublinCore

Jim Fulton jim at zope.com
Thu Oct 28 07:43:07 EDT 2004


Nicholas Wieland wrote:
> Hi again, I have a problem with a content object, when I try to add it
> it returns a system error.
> 
> #category.py
> class Category (Folder):
> 
>   implements (ICategory, ISiteContained, IProductContainer, ILocation)
> 
>   def setTitle (self, title):
>     dc = IZopeDublinCore (self)
>     dc.title = title
> 
>   def getTitle (self):
>     dc = IZopeDublinCore (self
>     return dc.title
> 
>   title = property (setTitle, getTitle)
> 
> #browser/configure.zcml
> <addform
>   label="Add Category"
>   name="addCategory.html"
>   schema=".interfaces.IProductCategory"
>   content_factory=".product_category.Category"
>   fields="title"
>   permission="zope.ManageContent"
>   />
> 
> The error is
> 
>   File "/usr/home/nicholas/Zope/src/zope/schema/_bootstrapfields.py",
> line 180, in set
>     setattr(object, self.__name__, value)
> TypeError: getTitle() takes exactly 1 argument (2 given)
> 
> If I don't use DC but a normal title = u'' it works as expected.
> I'm unable to track the problem.

Pay attention to the exception. getTitle is being called when setting
an attribute.  This should make you realize that maybe you set up the
property incorrectly, which is exactly what you did.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org



More information about the Zope3-dev mailing list