From: "Yanjun Wu" Subject: about Xen API's 'api' attribute Date: Sat, 6 Dec 2008 16:00:51 +0800 Message-ID: <13a1c1400812060000q58b2d7dyb999ab8faa0c8a4c@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org when reading the following code, the line marked with * calls hasattr(meth, 'api'). But I cannot find where 'api' attribute is set to the method after searching the whole directory. And also, what kind of typical methods are in self.xenapi? I traced to Unix PAM, then get stucked. thanks. ================ tools/python/xen/xend/server/XMLRPCServer.py : line 171 ---------------- # Register Xen API Functions # exportable functions are ones that do not begin with '_' # and has the 'api' attribute. for meth_name in dir(self.xenapi): if meth_name[0] != '_': meth = getattr(self.xenapi, meth_name) * if callable(meth) and hasattr(meth, 'api'): self.server.register_function(meth, getattr(meth, 'api')) ================