xmlrpc apis should be less strict?

Bug #420913 reported by Walter Cruz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
b2evolution
New
Medium
Unassigned

Bug Description

In our journey though xmlrpc api clients, I'm testing now blogtk 2.0.

It almost works, but sometimes I gor a error like:

<type 'exceptions.Exception'> <Fault 3: 'Incorrect parameters passed to method: Wanted boolean, got int at param 5'>

and this shows on xmlrpc.log:

2009-08-29 00:33:08 metaWeblog.editPost
Invalid signature.

The problem is the field published, in metaWeblog.editPost and metaWeblog.newPost.

a snippet from createPost in blogtk2 createPost:

  publish = xmlrpclib.Boolean(publish)

  # Sanitize time for xmlrpc transport if needed.
  if content['dateCreated']:
   if isinstance(content['dateCreated'], xmlrpclib.DateTime) == False:
    content['dateCreated'] = xmlrpclib.DateTime(content['dateCreated'])

  try:
   result = rpcServer.metaWeblog.newPost(blogid, self.username, self.password, content, publish)
  except:
   # Some systems want an int instead of a boolean value. We'll assuage their
   # craziness for now.
   if publish == True:
    publish = 1
   else:
    publish = 0
   try:
    result = rpcServer.metaWeblog.newPost(blogid, self.username, self.password, content, publish)
   except Exception, e:
    raise Exception, str(e)

In this case, tries create post first with publish as a boolean type, and after as a int type. But the editPost method passes publish = 1, that is casted to int, making our editPost in metaweblog fail.

What we can do is to change the signatures from some methods from something more stritct (like $xmlrpcBoolean) to a ganeric value, (like $xmlrpcValue) and make the checks ourselfs (or send patches to the blogging clients, I'm sending at least bug reports, but I know Python and can easily fix the editPost methods in blogtk2).

What should we do?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.