[mod_python] (no subject)

S.R.Pardá linux at qbox.es
Fri Jun 2 08:00:45 EDT 2006


I am desperated, I can't see the origin of this problem:

I have code like the next, but I receive errors using a class
Sometimes in __init__ method in Cliente I receive an error  saying
variable count has not been initiated (but count=0 is there to
initialize it)

Other times the error is accesing c.count, saying that count is not a
member of Cliente.

-- modcli.py ----------------------------------------------------------
class Cliente:
	def __init__(self, name):
		self.__class__.count += 1   # Sometimes ERROR here
		self.nombre = name

-- modform.py ------------------------------------------------------
import modcli
class Form:
	def __init__(self, funcWrite):
		c = modcli.Cliente('NOMBRE')
		#AND I TRY to verify here writing the expected value :

		funcWrite(c.count)    # HERE ERROR OCCURS with count

		# else tried:  modcli.Cliente.count 
		# and:  c.__class__.count

		return c

-- control.htm -----------------------------------------------------
<div> or
modForm = apache.import_module('modform')

cli = modForm.Form(req.write)

-- index.psp ----------------------------------------------------
<BODY ...
	<!-- include file="control.htm" -->

More information about the Mod_python mailing list