On Thu, Aug 13, 2009 at 7:51 AM, NealWalters <nealwalt...@nealwalters.com>wrote:

>
> When I append like this, my data is stored as HTML:
>
> myContent = "<h1>hello world</h1>"
> ms = gdata.MediaSource(file_handle=StringIO.StringIO(myContent),
> content_type='text/plain', content_length=len(myContent))
> updated_entry = client.Put(ms, created_entry.GetEditMediaLink().href +
> '?append=true')
> created_entry = client.Post(new_entry, '/feeds/documents/private/
> full')
> print 'Document now accessible online at:',
> created_entry.GetAlternateLink().href
> print 'GetEditMediaLink:', created_entry.GetEditMediaLink().href
>
> The above was the code I had working when I started this thread.
>
>
> 1) When I tried to store the document as part of the upload/create,
> the html shows in the text mode.
> For example, I see '<h1>Hello world</h1>' instead of the words "hello
> world" formatted as H1.  (See code below.)


This is because you're using 'text/plain' as a content type.
Try 'text/html'.


>
>
>
> 2) Above, I'm don't quite understand the difference in the new_entry
> and created_entry objects,
> therefore I don't understand how to get the GetEditMediaLink when I do
> the upload below...


I don't understand the question. new_entry and created_entry
are both DocumentsListEntry objects which should contain an edit link.

>
>
>
> myContent = "<h1>hello world</h1>"
> docTitle = "TestNewDoc01"
>
> ms = gdata.MediaSource(file_handle=StringIO.StringIO(myContent),
> content_type='text/plain', content_length=len(myContent))
> new_entry = client.UploadDocument(ms, docTitle)
> print 'Document now accessible online at:',
> created_entry.GetAlternateLink().href
> print 'GetEditMediaLink:', created_entry.GetEditMediaLink().href
>
>
> Thanks,
> Neal Walters
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Docs Data APIs" group.
To post to this group, send email to Google-Docs-Data-APIs@googlegroups.com
To unsubscribe from this group, send email to 
google-docs-data-apis+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to