Since you're modifying the folders content, you need to use the /foldersfeed
instead of the /documents list feed. Otherwise, MoveOutOfFolder()
simply deletes the document, referencing the edit link.
The documentation should clearer on this.

This worked for me:
...
for f in feed.entry:
  if f.title.text == 'tfol':
    eto = f

# eto.content.src is the folder's content (list of child documents)
feed = gd.GetDocumentListFeed(eto.content.src)
# move out first document in folder 'tfol'
entry = feed.entry[0]

print 'Moving document "%s" out of folder "%s"' % (entry.title.text,
eto.title.text)
gd.MoveOutOfFolder(entry)

So any time you're modifying the contents of a folder, the URIs need to be
/folders/....:
http://code.google.com/apis/documents/docs/2.0/developers_guide_protocol.html#MovingDocs

Eric

On Mon, Jun 15, 2009 at 4:30 AM, scott_w <d38dm8nw81k...@gmail.com> wrote:

>
> Hi, I've been working with the Python APIs to develop a file system.
> My problems occur when I try to move a file into the 'root directory'.
> Essentially when I moved a file out of a folder, it would erase the
> file instead of simply putting it under the "Items not in folders"
> category.
>
> Also, when moving a file out of a folder and into another folder, it
> simply puts it into both folders. Simply moving a file into a folder
> works as it should.
>
> I've written some test code to try and figure out how to correctly do
> this to try and simplify the steps needed to then be able to adapt it
> back into the main code base.
>
> Below is the test code I wrote. The folder I am moving the file into
> is tfol:
>
> --------
> gd = gdata.docs.service.DocsService()
> gd.email = em
> gd.password = pw
> gd.ProgrammaticLogin()
>
> q = gdata.docs.service.DocumentQuery(categories=['folder'], params=
> {'showfolders': 'true'})
> feed = gd.Query(q.ToUri())
>
> for f in feed.entry:
>        if f.title.text == 'tfol':
>                eto = f
>
> feed = gd.GetDocumentListFeed()
> entry = feed.entry[0]
>
> gd.MoveOutOfFolder(entry)
> gd.MoveDocumentIntoFolder(entry, eto)    ## Commenting this out causes
> the file referred to by entry
>
> ## to be erased
> --------
>
> Your help would be massively appreciated.
> Thanks,
> Scott W
> >
>

--~--~---------~--~----~------------~-------~--~----~
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