Locking some methods from certain clients

Cyril Elkaim celkaim at microform.fr
Mon Sep 27 11:36:15 EDT 1999


	Hi,

	I've the following question:

	I want to lock the accesse of some method of an object from other
objects using it. But on a class by class basis. What I want is the
possibility to know the class-name of a caller and if this caller is on
my access list let it use my method. Something like this:

class callee:
	def method(self):
		if __caller__ == "agreed":
			execute...
		else:
			raise callError, "caller no authorized to execute"

this class will be able to call the method
class aggreed:
	def run(self):
		x = callee()
		x.method()

this class not
class other:
	def ren(self):
	x = callee()
	c.method()

It's something like the export clause in Eiffel.

	Thanks in advance
	Cyril Elkaim




More information about the Python-list mailing list