maxcutler / python-wordpress-xmlrpc

Python library for WordPress XML-RPC integration
http://python-wordpress-xmlrpc.rtfd.org
MIT License
382 stars 130 forks source link

WordpressPost incorrectly remaps `author` field #63

Open teajaymars opened 10 years ago

teajaymars commented 10 years ago

https://github.com/maxcutler/python-wordpress-xmlrpc/blob/master/wordpress_xmlrpc/wordpress.py#L95

The Wordpress documentation makes it clear that the field name is post_author; following convention this might be remapped to author in this library, but I did not expect it to be remapped to user and just lost several hours of development time to this bug. (I assumed Wordpress was misbehaving...)

maxcutler commented 10 years ago

The fields of`WordPressPost are indeed documented at http://python-wordpress-xmlrpc.readthedocs.org/en/latest/ref/wordpress.html#wordpresspost

The WordPress XML-RPC API is inconsistent in its use of terms, and "user" is more often used than "author". WordPressComment and WordPressAuthor both use the term "user", and WordPressUser is the primary representation of a WordPress user account. Therefore I used the term "user" for posts in an attempt to make it more consistent within the library, since we are not able to change it on the WordPress side.

At this point I can't change the name without breaking backwards compatibility. I'm open to ideas (or pull requests) on how to make the documentation clearer.