X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dakweb%2Fdakwebserver.py;h=c4f3f58e470617b349b9612bd53d5bcae965ef9b;hb=4a4ada05f05875e9b420ba211caf44dd92849ad7;hp=24c729cc6f7a0d33b489f9fa9b98d5f46f9239b2;hpb=aed7e4798d61c491c709f079645b1ad22957cdbd;p=dak.git diff --git a/dakweb/dakwebserver.py b/dakweb/dakwebserver.py index 24c729cc..c4f3f58e 100755 --- a/dakweb/dakwebserver.py +++ b/dakweb/dakwebserver.py @@ -1,38 +1,48 @@ #!/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 +@copyright: 2014 Mark Hymers +@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()) + redirect("https://ftp-master.debian.org/epydoc/toc-dakweb-module.html") QueryRegister().register_path('/list_paths', list_paths) + @bottle.route('/path_help/') 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 from queries.archive import * +from queries.madison import * from queries.source import * from queries.suite import *