]> git.decadent.org.uk Git - dak.git/blobdiff - dakweb/dakwebserver.py
Instead of doing our own (bad) help, simply use existing epydoc foo and redirect...
[dak.git] / dakweb / dakwebserver.py
index 6102f84bd5d324657298cefe9cd9453c7a4a78cd..0f70d72b31a0598e6adda2e8a91f5e7586f64dc4 100755 (executable)
@@ -1,34 +1,43 @@
 #!/usr/bin/python
 
-# Main script to run the dakweb server and also
-# to provide the list_paths and path_help functions
+""" Main script to run the dakweb server and also
+to provide the list_paths and path_help functions
+
+@contact: Debian FTPMaster <ftpmaster@debian.org>
+@copyright: 2014  Mark Hymers <mhy@debian.org>
+@license: GNU General Public License version 2 or later
+"""
 
-from sqlalchemy import or_
 import bottle
-from daklib.dbconn import DBConn, DBSource, Suite, DSCFile, PoolFile
+from bottle import redirect
+from daklib.dbconn import DBConn
 import json
 
 from dakweb.webregister import QueryRegister
 
+
 @bottle.route('/')
 def root_path():
     """Returns a useless welcome message"""
     return json.dumps('Use the /list_paths path to list all available paths')
 QueryRegister().register_path('/', root_path)
 
+
 @bottle.route('/list_paths')
 def list_paths():
     """Returns a list of available paths"""
     return json.dumps(QueryRegister().get_paths())
 QueryRegister().register_path('/list_paths', list_paths)
 
+
 @bottle.route('/path_help/<path>')
 def path_help(path=None):
-
+    """Redirects to the API description containing the path_help"""
     if path is None:
         return bottle.HTTPError(503, 'Path not specified.')
 
-    return json.dumps(QueryRegister().get_path_help(path))
+    redirect("https://ftp-master.debian.org/epydoc/%s-module.html#%s" %
+             (QueryRegister().get_path_help(path), path))
 QueryRegister().register_path('/path_help', list_paths)
 
 # Import our other methods