« Return to Thread: autoforms and derived interfaces

Re: autoforms and derived interfaces

by Souheil CHELFOUH :: Rate this Message:

Reply to Author | View in Thread

This is maybe a bit off subject, but I dealt with this form/content/fields matters in a package :
http://tracker.trollfot.org/browser/projects/dolmen/dolmen.packages/dolmen.content/dolmen/content
If you want to have a look, maybe we can share opinions and fiddle something more interesting for both of us :)

2009/6/23 Jasper Spaans <j@...>
Hi,

The following code should speak for itself; is it supposed to work like
this? (the reason for the constructor is that form_fields takes its value
from IAction, which is not what I want as I'm adding/editting objects of
type context.__class__, which might implement interfaces derived from
IAction.)

trollfot on #grok mentioned that a use case for the current behaviour is
when you want to prevent editing all of the attributes of an object.

What's your opinion?

class EditAction(grok.EditForm):
   grok.name('edit')
   grok.context(IAction)
   grok.template('addaction')

   def __init__(self, context, request):
       super(EditAction, self).__init__(context, request)
       self.form_fields = grok.AutoFields(context.__class__)

Cheers,
--
Jasper Spaans

Fox-IT Experts in IT Security!
I www.fox-it.com
_______________________________________________
Grok-dev mailing list
Grok-dev@...
http://mail.zope.org/mailman/listinfo/grok-dev


_______________________________________________
Grok-dev mailing list
Grok-dev@...
http://mail.zope.org/mailman/listinfo/grok-dev

 « Return to Thread: autoforms and derived interfaces