[mod_python] form, req problem

Julio Mendoza jm at eemsystems.cjb.net
Wed Oct 15 15:03:24 EST 2003


this scrips was working good, but now i can't find what is the problem.

This was working in the following manner:

the firt time you call testpy control=''

then testpy return a html form with the variable: Fecha_Inicial,
Fecha_Final (in this case) an a hidden control with value '1'

The form action is the same function testpy, then in the second pass
control must be '1'... but this is not actualy the case.

I'm using python from debian/unstable



***********************************************************************

def testpy(req,control=''):
	if control=='':
		    return
aaa.simpleform2('./testpy',"Fecha_Inicial,Fecha_Final","Pacientes por
Medicos")
	elif control=='1':
		[Fecha_Inicial,Fecha_Final]=[req.form["Fecha_Inicial"],req.form["Fecha_Final"]]
		if len(Fecha_Final)<3:
				Fecha_Final=Fecha_Inicial
	return Fecha_Inicial,Fecha_Final,control

************************************************************************
#module: aaa


def simpleform2(action,strparametros,titulo='',insertar=''):
	import string
	s='''<form method="post" action="''' +action+ '"><input type="hidden"
name="control" value="1">'
	parametros=string.split(strparametros,',')
	if len(strparametros)>2:
		s=s+"""<table><caption>"""+titulo+"""</caption>"""
		for i in parametros:
			s=s+"""<tr><td>"""+i+''':</td>
	<td><input type="text" name="'''+i+'''" size="20" maxlength="30"
value="">
	</td>
	</tr>'''
		s=s+'</table>'
	s=s+insertar+'<br><input TYPE="submit" VALUE="Aceptar"></form>'
	return s
***************************************************************************



More information about the Mod_python mailing list