def ChangePhoto(self, media, contact_entry_or_url, content_type=None, 
      content_length=None):
    if isinstance(contact_entry_or_url, gdata.contacts.ContactEntry):
      url = contact_entry_or_url.GetPhotoEditLink().href
    else:
      url = contact_entry_or_url
    if isinstance(media, gdata.MediaSource):
      payload = media
    # If the media object is a file-like object, then use it as the file
    # handle in the in the MediaSource.
    elif hasattr(media, 'read'):
      payload = gdata.MediaSource(file_handle=media, 
          content_type=content_type, content_length=content_length)
    # Assume that the media object is a file name.
    else:
      payload = gdata.MediaSource(content_type=content_type, 
          content_length=content_length, file_path=media)
    return self.Put(payload, url)
Serialize representation of the tableset for local caching.
dataset/ETHPy150Open CollabQ/CollabQ/vendor/gdata/contacts/service.py/ContactsService.ChangePhoto--crossover with--dataset/ETHPy150Open yhat/db.py/db/db.py/ColumnSet.to_dict