[Zope] How to pass a Z SQL method a variable from a Python
Script?
Andrew Veitch
andrew@logicalprogression.net
Tue, 14 Jan 2003 18:53:55 +0000
You want to use container.send_to_database(CName=x, email=y, phone=z) or
alternatively make sure that CName, email and phone are in the REQUEST.
You also really should use <dtml-sqlvar> rather than <dtml-var> in your
method, that all of the quoting that SQL needs gets done.
A
On 14/1/03 6:43 pm, "Sage Mo" <sagefmo@nc.rr.com> wrote:
> This is probably a very basic question, but it's been stopping me for hours
> (very frustrating).
>
> I have a Python script that's trying to pass variables into a Z SQL method. In
> the Python script I wrote:
>
> container.send_to_database(CName, email, phone)
>
> where send_to_database is the Z SQL Method.
>
> send_to_database looks like this:
>
>
> Z SQL Method at / <http://www.heiropure.com/manage_workspace>
> send_to_database
> Help!
> <http://www.heiropure.com/HelpSys?help_url=/Control_Panel/Products/ZSQLMethods
> /Help/Z-SQL-Method_Edit.stx>
> Title
>
> Connection Id
> MySQL_database_connection
> Arguments
> CName email phone
> insert into name_table (CName, email, phone) values ("<dtml-var CName>",
> "<dtml-var email>", "<dtml-var phone>");
>
> Yet when I run the Python script, I get
>
> Zope Error
> Zope has encountered an error while publishing this resource. Error Type:
> KeyError
> Error Value: CName Am I passing the variables in the wrong way from the Python
> Script? Is there something wrong with the Z SQL method? In the Python script
> the variables CName, email, phone are well defined. Someone, anyone HELP! so I
> can actually do something besides look hopelessly at this error message for
> days on end.
>
>
>