All pastes #946444 Raw Edit

zope, dtml-in and z sql loopin

public text v1 · immutable
·published 2008-03-17 18:33 UTC
rendered paste body
<dtml-var standard_html_header>

<link rel="stylesheet" type="text/css" title="zenoss" href="/zport/portal_skins/zenoss.css">

<a href="cmdbifcfglook">view</a>
<br>


<FORM ACTION="passtest" METHOD="POST">
<dtml-let devname="this().getId()">
<dtml-in expr="grabifcfg(cmdb_name=devname)">

<table width=100% height=1%>
<tr>


<td class="tablevalues" align="center">if</td>
<td class="tablevalues" align="center" style = "background: #ffffcc"><input type="text" name="ifedit_iface" value="<dtml-var iface>" /></td>

<td class="tablevalues" align="center">addr</td>
<td class="tablevalues" align="center" style = "background: #ffffcc"><input type="text" name="ifedit_addr" value="<dtml-var addr>" /></td>

<td class="tablevalues" align="center">bcast</td>
<td class="tablevalues" align="center" style = "background: #ffffcc"><input type="text" name="ifedit_bcast" value="<dtml-var bcast>" /></td>

<td class="tablevalues" align="center">mask</td>
<td class="tablevalues" align="center" style = "background: #ffffcc"><input type="text" name="ifedit_mask" value="<dtml-var mask>" /></td>

<td class="tablevalues" align="center">hwaddy</td>
<td class="tablevalues" align="center" style = "background: #ffffcc"><input type="text" name="ifedit_hwaddy" value="<dtml-var hwaddy>" /></td>
</tr>
<td class="tablevalues" align="center" style = "background: #ffffcc"><input type="hidden" name="ifedit_id" value="<dtml-var id>" /></td>
</tr>
<td class="tablevalues" align="center"><INPUT NAME="submit_bigedit_field_value" TYPE="submit" value="update cmdb"></td>
<tr>

</tr>

</FORM>
</dtml-in>
</dtml-let>



____________________________________-

My problem is, the method im passing to only likes 1 value for each variable.  If grabifcfg comes back with more then one value, and i enter my loop, now im passing passtest multiple values for each var:

ifedit_addr	['10.110.0.110', '10.110.0.111', '10.110.0.112', '10.110.0.113']
ifedit_mask	['255.255.0.0', '255.255.0.0', '255.255.0.0', '255.255.0.0']

Rather then passing it multiple values, how do i run it once time for each iteration, rather then trying to cram all values into one pass.







______________-

# Import a standard function, and get the HTML request and response objects.
from Products.PythonScripts.standard import html_quote
request = container.REQUEST
RESPONSE =  request.RESPONSE

meh_id = (ifedit_id)
				
for i in range(0, len(meh_id)):
	print ifedit_id[i]
	print ifedit_iface[i]
	print ifedit_bcast[i]
	print ifedit_hwaddy[i]
	print ifedit_addr[i]
	print ifedit_mask[i]
		
context.if_update(ifedit_id=ifedit_id[i], ifedit_iface=ifedit_iface[i],ifedit_bcast=ifedit_bcast[i],ifedit_hwaddy=ifedit_hwaddy[i],ifedit_addr=ifedit_addr[i],ifedit_mask=ifedit_mask[i])
					
return printed