[z3-five] zope.formlib with DB

Dennis Schulz d.schulz81 at gmx.net
Fri Oct 20 16:11:15 CEST 2006


Thanks I will try it


-------- Original-Nachricht --------
Datum: Fri, 20 Oct 2006 15:20:48 +0200
Von: Maciej Wisniowski <maciej.wisniowski at coig.katowice.pl>
An: d.schulz81 at gmx.net
Betreff: Re: [z3-five] zope.formlib with DB

 >
 > > I am looking for an example of using zope.formlib in connection with a
 > > SQL database. (preferable SQLObject or SQLAlchemy as mapper)
 > > Means that I would have a container that doesn't look up in the 
ZODB but
 > > in the external database by default.
 > >   
 > I did something like that but with standard DB adapters.
 > I've used setupDataWidgets function found somewhere
 > in formlibcode that gets 'data' parameter to inject data
 > >from database. Function self.context._get_data()
 > in the example below returns data from db.
 >
 >
 > >from Products.Five.formlib.formbase import Form
 >
 > class TemplateFormlibForm(Form):
 >     """ testing formlib
 >     """
 >     prefix = 'tfl'
 >     form_fields = form.Fields(ITemplateFormlib)
 >
 >     def setUpWidgets(self, ignore_request=True):
 >         self.adapters = {}
 >         self.widgets = setUpDataWidgets(
 >                                           form_fields=self.form_fields,
 >                                           form_prefix=self.prefix,
 >                                           context=self.context,
 >                                           request=self.request,
 >                                           data=self.context._get_data(),
 >                                           ignore_request=ignore_request)
 >
 >
 > --
 > Maciej Wisniowski
Re: [z3-five] zope.formlib with DB


More information about the z3-five mailing list