Gender being changed to "Directory server" on Google Contacts insert

235 Views Asked by At

I'm using the gdata-python-client library (http://code.google.com/p/gdata-python-client/) to insert contacts into a Google account. When I set the gender like this:

google_contact.gender = gdata.contacts.data.Gender(text="Male")

it's actually being set on the contact in the field "Directory server".

Any ideas why this might be happening?

In case it affects anything, my code is running on a Google App Engine development server.

2

There are 2 best solutions below

2
On BEST ANSWER

Verily, I say unto you, this is indeed a bug in the gData client. Here is the line containing the bug, and here is the bug report I filed concerning the issue, and here's a patch I've submitted that solves the issue

The specifics of patching one's local copy of the library while the upstream fix is pending is left as an exercise for the reader.

0
On

This might be a bug in gdata library. At least that's how I see it. Not a google-contact expert here

consider this:

>>> print gdata.contacts.data.City(text="Foo")
<ns0:city xmlns:ns0="http://schemas.google.com/contact/2008">Foo</ns0:city>

while Gender returns this:

>>> print gdata.contacts.data.Gender(text="Male")
<ns0:directoryServer xmlns:ns0="http://schemas.google.com/contact/2008">Male</ns0:directoryServer>

Of course you can alter the tag property of Gender object manually:

>>> g = gdata.contacts.data.Gender(text="Male")
>>> g.tag='gender'
>>> print g
<ns0:gender xmlns:ns0="http://schemas.google.com/contact/2008">Male</ns0:gender>

Hope this helps