[mod_python] objects as actions

Jean-Philippe Barrette-LaPierre jpbarrette at savoirfairelinux.net
Wed Aug 25 10:35:44 EDT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I wanted to use classes intead of function for actions in mod_python. The only
thing it does is to display mymodule.myclass. I checked in the publisher code
and I saw that if it's an object, it does:

result = str(object)

Why couldn't we do this instead:


class MyObject:
	def __init__(self, req):
		self.req = req

	def __str__(self):
		return "some string"


and in the publisher:

objInst = object(req)
result = str(objInst)

(if it's an object)

Maybe I'm using it incorrectly and it works with classes, but I didn't saw any
way to do it
- --
Jean-Philippe Barrette-LaPierre
Maintener of curlpp
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBLJWw4k/6r/h0g7kRAlPzAKDEWiQX5hI84DHo68UtLwMXM6qAGACg41qk
kdFuUQ3pbpM0oSZ4IAU7BQE=
=0ze9
-----END PGP SIGNATURE-----


More information about the Mod_python mailing list