[Zope] setting Zclass instance id based on properties

Charlie Kalech Charlie at J-Town.co.il
Wed Dec 3 02:29:36 EST 2003


I'm trying to create a context-based id based on the properties.

There must be a way to customize the python constructor such that 
instead of two steps there is a third step that reassigns the value 
of the id based on properties *after* they are assigned.

I'm a designer, not a programmer - can somebody help me out here?

I'm looking for someone to fill in the third blank:

(1) Add a new instance of the ZClass
request = context.REQUEST
instance = container.MyZClass.createInObjectManager(request['id'], request)

(2) update a property sheet from the form values
instance.propertysheets.MyZClassProperties.manage_editProperties(request)

(3) set id to be equal several properties (such as section-chapter-book)




At 13:11 -0500 12/2/03, Small Business Services wrote:
>Charlie Kalech wrote:
>>  I would like to set the id of a Zclass instance based on some of the
>properties
>>
>>  I can not use the property variables in the add method since the
>>  properties have not yet been assigned a value
>>
>>  For instance let's say I have three properties: Section, Chapter and Page
>>
>>  How do I assign the id the value <dtml-var Section>-<dtml-var
>>  Chapter>-<dtml-var Page> when I create the zclass instance?
>
>There is no data in the 'Section', 'Chapter' or 'Page' until after you
>create an instance of your ZClass and assign some value to the properties.
>The property fields of a ZClass are just 'field names' until you create an
>instance of that ZClass, so you can't do anything with them.
>
>What are you trying to accomplish?
>
>Jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.zope.org/pipermail/zope/attachments/20031203/0b28ce75/attachment.html


More information about the Zope mailing list