Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xmlrpc_client.DateTime incompatible with timetuple() #53

Open
macedd opened this issue Feb 10, 2014 · 2 comments
Open

xmlrpc_client.DateTime incompatible with timetuple() #53

macedd opened this issue Feb 10, 2014 · 2 comments

Comments

@macedd
Copy link

macedd commented Feb 10, 2014

Hi

On python 2.7 at debian 7 I'm getting an error when the system converts XML Post Date into Python Tuple (/wordpress_xmlrpc/fieldmaps.py:88)

 *** ValueError: time data '2014-02-10 20:24:38' does not match format '%Y%m%dT%H:%M:%S'

It is clear that timetuple() was expecting '20140210T20:24:38' - which is very weird to me!

So I'm not sure if the module is really working or if my system have some inconsistency.

@macedd
Copy link
Author

macedd commented Feb 10, 2014

So to properly load a Post from RPC I had to add this to fieldmaps.DateTimeFieldMap.convert_to_python

import re
raw_value = re.sub(r'(\d+)-(\d+)-(\d+) ', r'\1\2\3T', raw_value)
if not isinstance(raw_value, xmlrpc_client.DateTime):
....

@macedd
Copy link
Author

macedd commented Mar 3, 2014

In fact the problem is with my custom method (I'm using wp plugin extapi to return query_post data) which may have different format.

I'm writing some custom wrappers around the WordPressPost result_class and DateTimeFieldMap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant