Re: Django: metaWeblog: dir() doesn't show methods

2012-05-22 Thread .
Thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Django: metaWeblog: dir() doesn't show methods

2012-05-20 Thread .
Hello,

I'm using Django and metaWeblog.

s = xmlrpclib.Server(http://localhost:8000/xmlrpc/;)
# Let's call a method
s.metaWeblog.test()
Test
# It works

#But it won't output available methods if I try to use dir() for this
purpose
dir(s.metaWeblog)
['_Method__name', '_Method__send', '__call__', '__doc__',
'__getattr__', '__init__', '__module__']
# It doesn't contain my test method

Is this a bug or some sort of encapsulation?


Regards
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Django: metaWeblog: dir() doesn't show methods

2012-05-20 Thread alex23
On May 21, 1:01 pm, . nkw...@gmail.com wrote:
 Is this a bug or some sort of encapsulation?

More or less the latter.

What you have is a server proxy, something that passes data back 
forth between your app and the XMLRPC-providing server. So when you
dir() it, it's showing you the methods of the proxy, not of the RPC
server.

You should be able to do s.system.listMethods() to pull back all
available methods. Or to just give you the ones relevant to
metaWeblog: [m for m in s.system.listMethods() if 'metaWeblog' in m]

-- 
http://mail.python.org/mailman/listinfo/python-list