[Zope] How to pass a Z SQL method a variable from a Python Script?
Ben Avery
ben@thesite.org
Tue, 14 Jan 2003 18:53:39 +0000
for starters, you should be using <dtml-zsqlvar ...> rather than
<dtml-var ...>, for security. Then removing the quotes, so your method
looks like:
insert into name_table
(CName, email, phone)
values
(<dtml-sqlvar CName type="string">, <dtml-sqlvar email type="string">,
<dtml-sqlvar phone type="string">)
then call using parameter names from the python script:
context.send_to_database(CName=CName, email=email, phone=phone)
does that work?
HTH
Ben Avery
p.s. cute kitten
Sage Mo 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 *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
> Arguments
>
> 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.
>
>