[Zope-CMF] how to store a reference?

Mark McEahern mark@mceahern.com
Wed, 23 Oct 2002 14:15:20 -0500


My hope is that this is really easy and my question merely reveals how
shallow my understanding of Zope is...

I have two portal types:  PressRelease and Contact.  A press release can
have one or more contacts.  So in the press_release_edit_form.pt for
PressRelease, I display the available contacts to choose from:

  <select name="contacts" multiple="true"
          tal:define="avail_contacts
python:here.aq_parent.objectValue(['Contact'])">
    <option tal:repeat="contact avail_contacts"
            tal:attributes="value contact/getId; selected python:contact in
here.contacts"
            tal:content="contact/contact_name"/>
  </select>

What I'm scratching my head over is how, in press_release_edit.py, I *save*
these contacts.  They'll get sent back in the RESPONSE as just plain strings
representing the contact.getId(), right?  How do I inflate those into the
Contact object before stuffing them in the press_release.contacts list?

I can probably brute force this, but this seems like such a common thing, I
have this gut feeling that I'm going to miss the obvious and simple
solution.

Any insights are appreciated!

Thanks,

// mark

-