Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

15 views
Skip to first unread message

.

unread,
May 20, 2012, 11:01:21 PM5/20/12
to
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

alex23

unread,
May 21, 2012, 1:13:39 AM5/21/12
to
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]

.

unread,
May 22, 2012, 5:10:37 PM5/22/12
to
Thanks.
0 new messages