google-code-export / gdata-python-client

Automatically exported from code.google.com/p/gdata-python-client
1 stars 0 forks source link

gdata.contacts.client.ContactsClient.get_profiles_feed() broken #423

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
==== What steps will reproduce the problem?

-- CODE -----------------
import gdata.contacts.client
client = gdata.contacts.client.ContactsClient()
client.contact_list = "domain.com"
client.client_login("admin@domain.com",
                    'password', 'sourcename', 'cp')

uri = client.get_feed_uri('profiles')
print client.get_profiles_feed(uri)
-- END CODE -------------

==== What is the expected output? What do you see instead?

Excepted : some data structure with the requested info.
Instead : 

Traceback (most recent call last):
  File "gcontacts_test.py", line 21, in <module>
    print client.get_profiles_feed(uri)
  File "/usr/lib/pymodules/python2.6/gdata/contacts/client.py", line 318, in get_profiles_feed
    desired_class=gdata.contacts.data.ProfilesFeedFromString)
  File "/usr/lib/pymodules/python2.6/atom/client.py", line 124, in get
    http_request=http_request, **kwargs)
  File "/usr/lib/pymodules/python2.6/gdata/client.py", line 276, in request
    version=get_xml_version(self.api_version))
  File "/usr/lib/pymodules/python2.6/atom/core.py", line 516, in parse
    return _xml_element_from_tree(tree, target_class, version)
  File "/usr/lib/pymodules/python2.6/atom/core.py", line 526, in _xml_element_from_tree
    if target_class._qname is None:
AttributeError: 'function' object has no attribute '_qname'

==== What version of the product are you using?

2.0.11

Original issue reported on code.google.com by guillaum...@gmail.com on 6 Aug 2010 at 6:06

GoogleCodeExporter commented 9 years ago
This patch should help to get the issue resolved (might not the best way to fix 
it) :

--- gdata/contacts/data.py  2010-08-06 14:19:24.128714926 -0400
+++ gdata/contacts/data.py.orig 2010-08-06 14:19:12.058711885 -0400
@@ -469,6 +469,6 @@
   Returns:
     A ProfilesFeed object corresponding to the given XML.
   """
-  return atom.core.parse(xml_string, ProfilesFeed)
+  return atom.core.parse(ProfilesFeed, xml_string)

--- gdata/contacts/client.py.orig   2010-08-06 14:27:50.718714109 -0400
+++ gdata/contacts/client.py    2010-08-06 14:27:55.298756159 -0400
@@ -313,9 +313,9 @@
       On failure, raises a RequestError.
     """

     uri = uri or self.GetFeedUri('profiles')    
-    return self.Get(uri,
-                    desired_class=gdata.contacts.data.ProfilesFeedFromString)
+    resp = self.Get(uri).read()
+    return gdata.contacts.data.ProfilesFeedFromString(resp)

   GetProfilesFeed = get_profiles_feed

Original comment by guillaum...@gmail.com on 6 Aug 2010 at 6:28

GoogleCodeExporter commented 9 years ago
A correction : the patch on gdata/contacts/data.py should be :

 return atom.core.parse(xml_string=xml_string, target_class=ProfilesFeed)

Original comment by guillaum...@gmail.com on 6 Aug 2010 at 6:37

GoogleCodeExporter commented 9 years ago
This will protect the ProfilesFeedFromString() function from API changes.

Original comment by guillaum...@gmail.com on 6 Aug 2010 at 6:38

GoogleCodeExporter commented 9 years ago
This is fixed in 9e049e10f5. 

Original comment by joe.gregorio@gmail.com on 17 Sep 2010 at 6:17