Re: multiple scripts in After Validattion Script field
Chuck Theobald <[email protected]> Fri, 12 Jun 2015 06:37:23 -0700
| Newsgroups | gmane.comp.web.zope.plone.user |
|---|---|
| Message-ID | <[email protected]> |
Okay, found the answer. Adding parens did indeed cause Plone to treat the SQL_createScanLogRow as a callable object. My callMe script now looks like: context.prepareForExport() return context.SQL_createScanLogRow() and works as needed. Thank you to all who replied. Plone comes through once again! You just have to know how to talk nice to it... Chuck On 15-06-11 11:55 PM, Chuck Theobald wrote: > No, SQL_createScanLogRow is a Z SQL Method. I'll see if adding parens > causes Plone to invoke it as a function, not sure how the dtml_sqlvars > will get resolved. Worth a try. > > I do find it odd that Plone didn't throw an error, but I suppose that > the callMe function simply treated context.SQL_createScanLogRow as > just another object. > > Chuck > > / > / > > > Nathan Van Gheem <[email protected]> wrote: > > SQL_createScanLogRow is a function call right? Should be > SQL_createScanLogRow() > > On Jun 11, 2015 7:42 PM, "Chuck Theobald" <[email protected] > <mailto:[email protected]>> wrote: > > Thanks, Steve, but will this work on a Z SQL Method? I created a > wrapping script, callMe, containing: > > context.prepareForExport() > request = container.REQUEST > date = request.form['principal-investigator'] > return context.SQL_createScanLogRow > > and set the After Validation Script to: > > python:folder.callMe() > > This correctly calls prepareForExport but does not do anything > about the SQL_createScanLogRow. I commented out the return in > prepareForExport, but still no records are written to the database. > > I have confirmed that createScanLogRow works if used alone as an > AfterValidationScript. > > Chuck > > > On 06/11/2015 02:53 PM, Steve McMahon wrote: >> Just write a script that calls both of the others. >> >> result = context.my_script() >> >> will call "my_script" on context and save the result. >> >> On Thu, Jun 11, 2015 at 2:43 PM, Chuck Theobald >> <[email protected] <mailto:[email protected]>> wrote: >> >> Plone 4.3.3, PFG 1.7.16 >> >> I am using an After Validation Script to do some calculations >> based on a >> few fields and writing the results to other fields. Now I >> want to store >> data in a database through a Z SQL Method per the PFG SQL >> CRUD tutorial >> at >> (http://docs.plone.org/5/en/working-with-content/managing-content/ploneformgen/sql_crud.html). >> I have this working great stand-alone, but need to combine it >> with the >> calculation script. >> >> I've tried putting "python:folder.prepareForExport(); >> here/SQL_createScanLogRow" into the After Validation Script, >> but this >> produces an error. How would I run both routines for After >> Validation? >> >> Alternatively, is there a way to invoke a Z SQL Method from >> within the >> python script? >> >> Thanks >> >> -- >> Chuck Theobald >> System Administrator >> The Robert and Beverly Lewis Center for Neuroimaging >> University of Oregon >> P: 541-346-0343 <tel:541-346-0343> >> F: 541-346-0345 <tel:541-346-0345> >> >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> Plone-Users mailing list >> [email protected] >> <mailto:[email protected]> >> https://lists.sourceforge.net/lists/listinfo/plone-users >> >> >> >> >> ------------------------------------------------------------------------------ >> >> >> _______________________________________________ >> Plone-Users mailing list >> [email protected] <mailto:[email protected]> >> https://lists.sourceforge.net/lists/listinfo/plone-users > > -- > Chuck Theobald > System Administrator > The Robert and Beverly Lewis Center for Neuroimaging > University of Oregon > P:541-346-0343 <tel:541-346-0343> > F:541-346-0345 <tel:541-346-0345> > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Plone-Users mailing list > [email protected] > <mailto:[email protected]> > https://lists.sourceforge.net/lists/listinfo/plone-users > > > > ------------------------------------------------------------------------------ > > > _______________________________________________ > Plone-Users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/plone-users -- Chuck Theobald System Adminstrator The Robert & Beverly Lewis Center for Neuroimaging University of Oregon ------------------------------------------------------------------------------ _______________________________________________ Plone-Users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/plone-users