[Zope3-Users] Annotations when creating a Principal

Kevin Gill (Newaddress) Kevin.gill at newaddress.ie
Wed May 9 14:34:02 EDT 2007


Hi, 

I am following the example in chapter 22 of Philipps book. I am setting
up the PAU so that new users can register with the site. I am extending
the example so that the information entered when creating the Principal
is copied to the Annotations. Thus I can present the user with a one
step sign-up.

I have changed the code on creating the new principal. I retrieve the
principal, adapt it to the IMemberInfo class and set the email
Annotation to the login name. Here is the code.



        principal_id = folder.signUp(login, password, title)

        pau = getUtility(IAuthentication)

        pi = PrincipalInfo(principal_id, login, title, u'')
        factory = FoundPrincipalFactory(pi)
        principal = factory(pau)

        memberinfo = IMemberInfo(principal)
        memberinfo.email = login

This code runs but the metadata change is not saved to the database.

My questions are ...

Can I set metadata on an object in the interaction in which the object
is being created?

I am assuming that the principal returned by the FoundPrincipalFactory
is the same as a normal principal when the use is logged in. Is this
assumption valid?

Is the meta data approach the best approach? Would it be easier to
replace the InternalPrincipal with a content object which contains my
new data?  If I do that can I access that data via the standard
principal machinery?


Thanks in advance


Kevin Gill


**************************************************************************************************
www.commuterhomes.ie - MyHome.ie are sponsoring the Commuter Homes Exhibition 
2007 which takes place this Sunday 4th of March in The Lynch Green Isle Hotel, 
Naas Road, Dublin 22 from 1pm – 6pm. FREE ADMISSION.

**************************************************************************************************
The contents of this email and any attachments are confidential.
They are intended for the named recipient(s) only.
If you have received this email in error please notify the system manager or  the 
sender immediately and do not disclose the contents to anyone or make copies.

** eSafe scanned this email for viruses, vandals and malicious content. **
**************************************************************************************************


More information about the Zope3-users mailing list