amirpk / gdata-python-client

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

ToString() is lossy #263

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
import gdata.photos.service
url = 'http://picasaweb.google.com/data/feed/api/user/yonathan'
service = gdata.photos.service.PhotosService()
albums = service.GetFeed(url)
albums2 = gdata.photos.AnyFeedFromString(albums.ToString())
assert len(albums.entry) == len(albums2.entry)

What is the expected output? What do you see instead?
When serialized, photos.entry is always empty [].

What version of the product are you using?
2.0.0

Please provide any additional information below.
The problem is that some of the feeds that subclass GPhotosBaseFeed 
(AlbumFeed, UserFeed) have different entry types depending on the request, 
so GPhotoBaseFeed deletes atom:entry from its children and overrides  
_ConvertElementTreeToMember. Unfortunately, no one overrode the 
corresponding _AddMembersToElementTree.

Two choices:
1) Override atom.AtomBase._AddMembersToElementTree within GPhotosBaseFeed.
2) Refactor the feed classes so that their children types are known 
statically, so that AtomBase works as intended without overriding any 
methods.

Original issue reported on code.google.com by yonathan@gmail.com on 13 Jul 2009 at 6:46