[Zope3-Users] factory - but object is not initialized

Thierry FLORAC tflorac at ulthar.net
Mon Feb 13 10:59:35 EST 2006


On Mon, 2006-02-13 at 16:31 +0100, Egon Frerich wrote:
> for a content component I have programmed a factory to be sure numeric
> fields have 0.0. If I add an object without numeric values the
> introspectors tells me these fields have type "NoneType" and the values
> are "None".
> 
> Logging informations inform the factory is called and these fields
> contain 0.0.
> 
> The datafields are instances of FieldProperty.
> 
> What have I to do?

>From my recent experience, I think you should :
 - define a default value for your properties in your content
interface :

    myFloatProperty1 = Float (..., default=0.0)
    myFloatProperty2 = Float (..., default=0.0)

 - define the "set_before_add" value in your browser package
"configure.zcml"

	<addform
		schema=".interfaces.IMyInterface"
		set_before_add="myFloatProperty1 myFloatProperty2"
		...
		/>

I think that this should do the job you're looking for.

  Thierry



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the Zope3-users mailing list