climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1563527 - /incubator/climate/trunk/ocw-ui/backend/directory_helpers.py
Date Sat, 01 Feb 2014 23:57:29 GMT
Author: joyce
Date: Sat Feb  1 23:57:29 2014
New Revision: 1563527

URL: http://svn.apache.org/r1563527
Log:
CLIMATE-326 - Add /dir/list/ documentation

Modified:
    incubator/climate/trunk/ocw-ui/backend/directory_helpers.py

Modified: incubator/climate/trunk/ocw-ui/backend/directory_helpers.py
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/ocw-ui/backend/directory_helpers.py?rev=1563527&r1=1563526&r2=1563527&view=diff
==============================================================================
--- incubator/climate/trunk/ocw-ui/backend/directory_helpers.py (original)
+++ incubator/climate/trunk/ocw-ui/backend/directory_helpers.py Sat Feb  1 23:57:29 2014
@@ -26,11 +26,36 @@ import sys
 dir_app = Bottle()
 
 PATH_LEADER = "/usr/local/rcmes"
+WORK_DIR = "/tmp/rcmet"
 
 @dir_app.route('/list/')
 @dir_app.route('/list/<dir_path:path>')
 def get_directory_info(dir_path='/'):
-    ''''''
+    ''' Return the listing of a supplied path.
+
+    :param dir_path: The directory path to list.
+    :type dir_path: String
+
+    :returns: Dictionary containing the directory listing if possible.
+
+    * Example successful JSON return *
+
+    .. sourcecode: javascript
+
+        {
+            'listing': [
+                '/bar/',
+                '/baz.txt',
+                '/test.txt'
+            ]
+        }
+
+    * Example failure JSON return *
+
+    .. sourcecode: javascript
+
+        {'listing': []}
+    '''
     try:
         clean_path = _get_clean_directory_path(PATH_LEADER, dir_path)
         dir_listing = os.listdir(clean_path)
@@ -56,8 +81,6 @@ def get_directory_info(dir_path='/'):
         return "%s(%s)" % (request.query.callback, {'listing': dir_info})
     return {'listing': dir_info}
 
-WORK_DIR = "/tmp/rcmet"
-
 @dir_app.route('/getResultDirInfo')
 def getResultDirInfo():
     dirPath = WORK_DIR



Mime
View raw message