.py.txt to .py
python -i tutorial.py. -i causes the python interpreter to remain open once the script has completed - which makes it easier to inspect the value of variables and experiment with function calls.
TODO. Explore the *API documentation for XMLRPC* and *Full API documentation* to determine which function to call
raise statement, which causes the script to halt. This is to stop the script running straight though and failing noisily due to being incomplete. Once you've completed one step, remove the next raise statement to proceed onto the next step.
make ACR connection
get homespace root ivorn from ACR
CALL copyFolder(home root ivorn, current local folder)
FUNCTION copyFolder(myspace folder ivorn, local folder)
get myspace folder info from ACR for given ivorn
IF folder is not of type 'folder'
RAISE error as user has called this function with a file by mistake
ENDIF
get myspace folder name from folder info
make new subfolder s in current local folder with myspace folder name
get contents of myspace folder from ACR (as a list of ivorns)
FOR each item in myspace folder contents
get fileinfo for item from ACR
IF item is of type 'file'
get url of file contents from ACR
create new local file in subfolder s
copy contents of url to local file
ELSE
CALL copyFolder(item's ivorn, s)
END IF
END FOR
END FUNCTION
make ACR connection
get ivorn of root folder in home MySpace
get current local folder pwd
CALL copyFolder(pwd, home ivorn)
FUNCTION copyFolder(localFolder, remoteFolder):
get folderInfo from acr for remoteFolder
IF remoteFolder is not of type 'folder' or localFolder is not a folder
RAISE error // This function should be called with folders as args
ENDIF
get contents of localFolder
FOR f in contents:
IF f is a file
use acr to create a file in remoteFolder with same name as f
use acr to copy contents of f to new file
ELSE
use acr to create a folder in remoteFolder with same name as f
copyFolder(localFolder/f, remoteDir)
END IF
END FOR
END FUNCTION
make ACR connection IF number of arguments is zero get ivorn of home myspace from acr ELSE use first argument as ivorn END IF get info for ivorn from ACR IF ivorn is a file list_of_ivorns = supplied ivorn ELSE list_of_ivorns = get list of child ivorns from ACR END IF FOR each ivorn in list_of_ivorns get info from ACR PRINT file name END FOR
| I | Attachment | Action | Size | Date | Who | Comment |
|---|---|---|---|---|---|---|
| | application-vo-aware.odp | manage | 806.8 K | 24 Jan 2006 - 17:46 | NoelWinstanley | Open Office Presentation |
| | application-vo-aware.pdf | manage | 984.0 K | 24 Jan 2006 - 17:48 | NoelWinstanley | PDF version of presentation |
| | run-sdss.py.txt | manage | 3.1 K | 01 Feb 2006 - 14:07 | NoelWinstanley | science by python and astogrid. |
| | maven-base.css | manage | 2.2 K | 01 Feb 2006 - 14:13 | NoelWinstanley | |
| | xmlrpc.html | manage | 106.0 K | 01 Feb 2006 - 14:17 | NoelWinstanley | documentation for api |
![]() |
Click here for the AstroGrid Service Web |
This is the AstroGrid Development Wiki |
|