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

?

.

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
 
A

alex23

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,832
Latest member
GlennSmall

Latest Threads

Top