[Zope] Re: ZClasses and "title" property

Aaron Louie ajlouie@u.washington.edu
Tue, 23 Jan 2001 09:59:44 -0800


I think the problem goes deeper than that. Zope 2.3x no longer allows the
setting or creation of any property called "title" for new ZClasses. Period
(At least, not in the same way it used to). Try it for yourself. If you
follow the steps in the "ZClass Properties" How-to
(http://www.zope.org/Members/lstaffor/zProperties), you'll find that Zope
2.3x gives a "The id 'title' is invalid--it is already in use" error when
you try to create a property called "title".

Fine, you say, it's already there by default, right?

Finish out the How-To, setting all the proper permissions, modifying the
addForm and the constructor to accomodate your other properties. Then try
creating an instance of your new class and setting the 'title' property
through the addForm. The title will not be set when you hit 'Add'. The field
will remain empty...

Of course, the How-To above worked just fine in 2.2.5. Doesn't work anymore.
There is no longer any default place to set the title in a new ZClass and
the title property cannot be set thru DTML. (Haven't tried it in Python yet)

Is this a bug or am I missing something?

ajl

>> I guessed it was something like this, so this leads me to two followup
>> questions.
>>
>> 1) I'd be happy to use the built-in title property assuming that it
>>   won't cause some kind of problem.  I just don't know how I can set
>>   that in instance objects since it doesn't appear on the property
>>   sheet.  Can I modify the addForm and add methods for the class to
>>   set it there?  Do I need to make a custom view?  What approach do
>>   most people take in this situation, using the built-in title or
>>   choosing a different name for a title-like property?
>>

> I use Title (note the upper-casity), and then I add a Python Mehtod (or in
> 2.3 a Python Script) called 'title' that simply does:
> return self.Title
>(or in a P.S.:
> return context.Title
> should do it
>)