On Tue, Nov 08, 2005, Kent Johnson wrote: >Kent Johnson wrote: >> Bill Campbell wrote: >> >>>Is there a way in python for a method to determine its parent? >>> >>>In particular, I'm working with SimpleXMLRPCServer, and would >>>like to be able to find the client_address in the routine that >>>has been dispatched. I know that client_address is an attribute >>>of the handler class instance, but don't know how to get to that. > ... good stuff deleted...
>HOWEVER, I don't think this is a good solution to your problem - it's quite >a fragile hack. Better would be to find a way to pass the information you >need to your function. For example, from a quick look at the code for >SimpleXMLRPCServer, it looks like you could subclass SimpleXMLRPCServer and >make your own _dispatch() method that adds client_address to the parameter >list, then all your functions would be passed the client_address. Or even >specialize it so that just one special function gets this treatment. That's one solution that I had considered, but in this particular case, I will probably use the CGI version of the XMLRPCServer since I can get the information from the REMOTE_ADDR environment variable that apache will set for me. The problem I'm working on now is to have our client's machines connect to our XML-RPC server in cron jobs which will do at least two things, check to see if their dynamic IP address has changed so we can update DNS for them, and/or let our system know they're still alive and functioning. This part of the job is probably best handled behind apache using the CGIXMLRPCRequestHandler as it makes some things simpler and can be done via https. Being fairly new to python, I wanted to know if there was a clean way to get parent information if the author of a package hadn't provided this. I generally have attributes in children that point back to the parent making it easy to get back to the parent from the child. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC UUCP: camco!bill PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 URL: http://www.celestial.com/ ``The children who know how to think for themselves spoil the harmony of the collective society that is coming, where everyone would be interdependent.'' 1899 John Dewey, educational philosopher, proponent of modern public schools. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor