← Back to team overview

evoteam team mailing list archive

[Bug 420913] [NEW] xmlrpc apis should be less strict?

 

Public bug reported:

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?

** Affects: b2evolution
     Importance: Medium
         Status: New


** Tags: api metaweblog movabletype wordpress xmlrpc

-- 
xmlrpc apis should be less strict?
https://bugs.launchpad.net/bugs/420913
You received this bug notification because you are a member of Evoteam,
which is subscribed to b2evolution.

Status in b2evolution: New

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?



Follow ups

References