[Tutor] initialization of classes.

Ibraheem Umaru-Mohammed ibraheem@micromuse.com
Mon, 12 Feb 2001 17:18:49 +0000


Hi,


On Mon, Feb 12, 2001 at 11:57:09AM -0500, Furmanek, Greg wrote:
> Here is a Problem:
> 
> I am trying to pass a class to another class and 
> initialize the passed class if it is not passed
> when the main class is initialized.  
> 
> This is the piece of code and error I get.
> 
> Thanks for help.
> 
> #============  Code Start ==============================
> 
> class connection:
> 
> 
> 	def __init__ \
> 		(self, \
> 		l_acc_stat = "", \
> 		l_user_info = c_user_info(), \

c_user_info is not defined at this point -  move the definition
of c_user_info above (i.e. before ) the definition of connection. 
You will probably then find that "user_group" (and the other undefined
functions)are not well....defined. 

> 		l_tun_type = "", \
> 		l_acc_info = c_acct_info(), \
> 		l_net_info = c_network_info()):
> 
> 		self.account_status = l_acc_stat
> 		self.user = l_user_info
> 		self.Class = ""				# not used
> 		self.Tunnel_Type = l_tun_type
> 		self.acct_info = l_acc_info
> 		self.network_info = l_net_info
> 
> 
> 	def load_account_status(self, acc_stat):
> 		self.account_status = acc_stat
> 
> 
> 	def load_user_info(self, l_user_info):
> 		self.user = l_user_info
> 
> class c_user_info:
> 
> 
> 	def __init__(self):
> 		self.User_Name = ""
> 		self.User_Full_Name = ""
> 		self.User_Group = user_group 

Kindest regards,

	--ibs.
	
-- 
--------------------------------------------------------------------------------
			--  Ibraheem Umaru-Mohammed  --
			--  Email:ium@micromuse.com  --
-- Micromuse PLC, Disraeli House, 90 Putney Bridge Road, London SW18 1DA --
			--  http://www.micromuse.com --
--------------------------------------------------------------------------------