[Grok-dev] object relationships
Jeroen Michiel
jmichiel at yahoo.com
Thu Feb 12 08:27:19 EST 2009
Martijn Faassen-2 wrote:
>
> Hey Jeroen,
>
> Can you try the new releases of z3c.relationfield and
> z3c.relationfieldui and see whether they work better? It took me a while
> to get around to this, but the support should be in there now. See my
> other post in this thread for more info.
>
> Regards,
>
> Martijn
>
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev
>
>
I tried with the new version, but i have the same issue with applyData:
line 53 in z3c/relationfield/event.py raises a KeyError in updateRelations
on getId:
rels = list(catalog.findRelations({'from_id': intids.getId(obj)}))
because an ObjectModified event is triggered
If you want to reproduce, try this code (with a few extra's which I'm sure
you'll figure out):
class IBuddy(Interface, relationfield.interfaces.IHasRelations):
name = schema.TextLine(title=u'The Name')
buddy = relationfield.RelationChoice(title=u'My Buddy', required=False,
source = BuddySource())
class AddBuddy(grok.AddForm):
grok.context(grok.Container)
grok.name('add')
form_fields = grok.Fields(IBuddy)
@grok.action('Add')
def Add(self, **data):
buddy = Buddy()
self.applyData(buddy, **data)
self.context[buddy.name] = buddy
self.redirect(self.url(buddy))
--
View this message in context: http://www.nabble.com/object-relationships-tp21706997p21976036.html
Sent from the Grok mailing list archive at Nabble.com.
More information about the Grok-dev
mailing list