]> khamidou — GitHub mirrors - cagibi.git/commitdiff
serve file data
authorkarim hamidou <khamidou@gmail.com>
Fri, 13 Jul 2012 07:05:30 +0000 (09:05 +0200)
committerkarim hamidou <khamidou@gmail.com>
Fri, 13 Jul 2012 07:05:30 +0000 (09:05 +0200)
cagibi/server.py

index d2c48a0f964ac9667494159cd4ce414792357554..37018893cf4460868e02de589e1da74920f510b8 100644 (file)
@@ -1,4 +1,4 @@
-from bottle import Bottle, route, run, post, get, put, delete, request, abort
+from bottle import Bottle, route, run, post, get, put, delete, request, abort, static_file
 import os, time
 import json
 from config import load_config, save_config
@@ -58,6 +58,10 @@ def delete_file(filename):
 def file_info(filename):
     return json.dumps(files_info[filename])
 
+@get('/files/<filename>/data')
+def file_data(filename):
+    return static_file(filename, root=cagibi_folder)
+
 @post('/files/<filename>/deltas')
 def return_deltas(filename):
     """return the deltas corresponding to the file. The client must send in its request the hashes of the file"""