Re: [Zope] Use of the :records variable type and ZSQL methods
Calvin Parker wrote: > > > > Error Type: Bad Request > > > Error Value: ['Field1', 'Field2'] > > > > > > Here is the code I used and sqlTest is the ZSQL Method that > > just inserts the > > > two fields into a test DB: > > > > > > > > > > > > > > > > > > What am I doing wrong? > > > > > > > you'll have to feed a named argument to your Zsql method (that is in its > > definition). In this case that would be testlist. Then it should work as > > expected > > > > Here is the Z SQL Method. It takes the arguments Field1 and Field2. > that's where the problem is: in your REQUEST there _are_ no Field1 and Field2: they are in the testlist (pseudo) dictionary. Make you method (something like): INSERT INTO Test_Fields (Field1,Field2) VALUES ( , ) >Am I calling testlist incorrectly? I have tried forcing the namespace with >the dtml-with tag, but it doesn't seem to be making any difference. Are the >arguments field in the Method what you are refering to when you say named >argument? I think so (terminology is a bit confusing here). ZSQL methods only take named arguments. There has been quite a bit of threads on this on the list. SO you might want to search the archives for them. In this case the named argument would have to be testlist, as this is the argument REQUEST contains. Rik ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
RE: [Zope] Use of the :records variable type and ZSQL methods
> > Error Type: Bad Request > > Error Value: ['Field1', 'Field2'] > > > > Here is the code I used and sqlTest is the ZSQL Method that > just inserts the > > two fields into a test DB: > > > > > > > > > > > > What am I doing wrong? > > > > you'll have to feed a named argument to your Zsql method (that is in its > definition). In this case that would be testlist. Then it should work as > expected > Here is the Z SQL Method. It takes the arguments Field1 and Field2. INSERT INTO Test_Fields (Field1,Field2) VALUES ( , ) Am I calling testlist incorrectly? I have tried forcing the namespace with the dtml-with tag, but it doesn't seem to be making any difference. Are the arguments field in the Method what you are refering to when you say named argument? Thanks, Calvin ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Use of the :records variable type and ZSQL methods
> > Error Type: Bad Request > Error Value: ['Field1', 'Field2'] > > Here is the code I used and sqlTest is the ZSQL Method that just inserts the > two fields into a test DB: > > > > > > What am I doing wrong? > you'll have to feed a named argument to your Zsql method (that is in its definition). In this case that would be testlist. Then it should work as expected hth Rik ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Use of the :records variable type and ZSQL methods
I am trying to take in a form that has multiple records like this: Field1 Field2 Field1 Field2 Field1 Field2 I want to loop through the records on the add_records page. It works fine if I do this and just display them: I get the following error if I try looping it through a ZSQL Method: Error Type: Bad Request Error Value: ['Field1', 'Field2'] Here is the code I used and sqlTest is the ZSQL Method that just inserts the two fields into a test DB: What am I doing wrong? Calvin ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )