[Zope-DB] zsql question

Laura McCord Laura.McCord at doucet-austin.com
Thu Oct 7 14:48:20 EDT 2004


Ok I figured it out. This is what I ended up doing:

<dtml-if "len(ipAddress) > 0">
insert into NetInt(IPAddress, SystemNetName)
Values(
'<dtml-var name="ipAddress" sql_quote>',
'<dtml-var name="HostName" sql_quote>'
)
</dtml-if>

Thanks for the suggestions and the time.

 -Laura

-----Original Message-----
From: Jim Abramson [mailto:jabramson at wgen.net] 
Sent: Thursday, October 07, 2004 1:07 PM
To: Laura McCord
Cc: zope-db at zope.org
Subject: RE: [Zope-DB] zsql question


That should pretty much do it.

If you want to go even further, you could write a python script to make
sure the IP address is valid and make that your if condition:

<dtml-if "validIpAddress(ipAddress)">insert...

You could dtml-raise if the ip was _not_ valid (I _think_ that would
work in a sqlmethod...)

Jim

> -----Original Message-----
> From: Laura McCord [mailto:Laura.McCord at doucet-austin.com]
> Sent: Thursday, October 07, 2004 1:05 PM
> To: zope-db at zope.org
> Subject: [Zope-DB] zsql question
> 
> I am trying to do an insert but I do not want the insert to
> occur if the value of "ipAddress" was not entered in the form.
> 
> So far I have this:
> 
> insert into NetInt(IPAddress, SystemNetName) Values(
> '<dtml-var name="ipAddress" sql_quote>', '<dtml-var 
> name="HostName" sql_quote>'
> )
> 
> I am thinking that I have to put a conditional statement such
> as <dtml-if ipAddress>  insert into NetInt(IPAddress, 
> SystemNetName) Values( '<dtml-var name="ipAddress" 
> sql_quote>', '<dtml-var name="HostName" sql_quote>'
> )
> </dtml-if>
> 
> Any suggestions?
> 
> Thanks,
>  Laura
> _______________________________________________
> Zope-DB mailing list
> Zope-DB at zope.org http://mail.zope.org/mailman/listinfo/zope-db
> 


More information about the Zope-DB mailing list