google-code-export / gdata-python-client

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

QName versioning fails when different namespaces with different schema versions are used #483

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently I can effect the "version" with which atom elements are parsed by 
setting client.api_version, but this is the gdata version (eg 1.1), and it 
seems though that different namespaced elements might have different versions, 
eg the "app" or "opensearch" namespace expects a version starting with '2'.

Because of this, an element such as opensearch:totalResults will default to the 
wrong version and thus the element will not be correctly detected.

Original issue reported on code.google.com by afs...@google.com on 30 Dec 2010 at 1:03

GoogleCodeExporter commented 9 years ago
Do you have sample code that replicates this behavior?

Original comment by joe.gregorio@gmail.com on 20 Jan 2011 at 8:33

GoogleCodeExporter commented 9 years ago
Sorry I don't have access to code here, but (untested):

class MyElement(atom.core.XmlElement):

    _qname = '{http://schemas.google.com/}myelement'

class MyFeed(gdata.data.GDFeed):

    totalResults = gdata.data.TotalResults
    myAttribute = MyElement

Because gdata.data.TotalResults has a tuple qname, the fqdn is chosen as the 
index of the tuple corresponding to the global version, which defaults to the 
wrong element (0, instead of 1) and I couldn't find a way of setting the 
version without overriding the whole thing with this workaround:

http://code.google.com/p/gdata-python-client/source/browse/src/gdata/contentfors
hopping/data.py#704

Original comment by afs...@google.com on 21 Jan 2011 at 6:08

GoogleCodeExporter commented 9 years ago
I should also mention that I couldn't think of a fix!

Original comment by afs...@google.com on 21 Jan 2011 at 6:11

GoogleCodeExporter commented 9 years ago
Worked around, probably won't be a general problem.

Original comment by afs...@google.com on 7 Oct 2011 at 10:37