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

Discussion in 'Python' started by ., May 21, 2012.

  1. .

    . Guest

    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
     
    ., May 21, 2012
    #1
    1. Advertising

  2. .

    alex23 Guest

    On May 21, 1:01 pm, "." <> 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]
     
    alex23, May 21, 2012
    #2
    1. Advertising

  3. .

    . Guest

    Thanks.
     
    ., May 22, 2012
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UnVkeQ==?=

    Sub Dir, Virtual dir, what do I use?

    =?Utf-8?B?UnVkeQ==?=, Jun 12, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    443
    =?Utf-8?B?UnVkeQ==?=
    Jun 12, 2005
  2. DG
    Replies:
    3
    Views:
    346
    Terry Reedy
    Jul 22, 2009
  3. John Posner

    Question on Django and Django Book

    John Posner, Nov 13, 2010, in forum: Python
    Replies:
    0
    Views:
    337
    John Posner
    Nov 13, 2010
  4. eGenix Team: M.-A. Lemburg
    Replies:
    0
    Views:
    150
    eGenix Team: M.-A. Lemburg
    Jun 18, 2013
  5. Gary Roach
    Replies:
    0
    Views:
    149
    Gary Roach
    Jan 2, 2014
Loading...

Share This Page