Merge pull request #35 from gissehel/move

.move()
This commit is contained in:
Richard O'Dwyer 2013-05-08 03:22:28 -07:00
commit 330ee7203a
2 changed files with 21 additions and 1 deletions

View file

@ -74,6 +74,12 @@ m.create_folder('new_folder')
file = m.find('myfile.doc')
m.rename(file, 'my_file.doc')
```
### Moving a file or a folder into another folder
```python
file = m.find('myfile.doc')
folder = m.find('myfolder')
m.move(file[0], folder)
```
### Search account for a file, and get its public link
```python
file = m.find('myfile.doc')

View file

@ -370,10 +370,24 @@ class Mega(object):
2 : root
3 : inbox
4 : trash
or
target's id
or
target's structure returned by find
"""
#determine target_node_id
target_node_id = str(self.get_node_by_type(target)[0])
if type(target) == int:
target_node_id = str(self.get_node_by_type(target)[0])
elif type(target) in (str,unicode):
target_node_id = target
else:
file = target[1]
target_node_id = file['h']
return self.api_request({'a': 'm',
'n': file_id,
't': target_node_id,