3 """ Main script to run the dakweb server and also
4 to provide the list_paths and path_help functions
6 @contact: Debian FTPMaster <ftpmaster@debian.org>
7 @copyright: 2014 Mark Hymers <mhy@debian.org>
8 @license: GNU General Public License version 2 or later
12 from bottle import redirect
13 from daklib.dbconn import DBConn
16 from dakweb.webregister import QueryRegister
21 """Returns a useless welcome message"""
22 return json.dumps('Use the /list_paths path to list all available paths')
23 QueryRegister().register_path('/', root_path)
26 @bottle.route('/list_paths')
28 """Returns a list of available paths"""
29 redirect("https://ftp-master.debian.org/epydoc/dakweb-module.html#__package__")
30 QueryRegister().register_path('/list_paths', list_paths)
33 @bottle.route('/path_help/<path>')
34 def path_help(path=None):
35 """Redirects to the API description containing the path_help"""
37 return bottle.HTTPError(503, 'Path not specified.')
39 redirect("https://ftp-master.debian.org/epydoc/%s-module.html#%s" %
40 (QueryRegister().get_path_help(path), path))
41 QueryRegister().register_path('/path_help', list_paths)
43 # Import our other methods
44 from queries.archive import *
45 from queries.madison import *
46 from queries.source import *
47 from queries.suite import *
49 # Set up our initial database connection
52 # Run the bottle if we're called directly
53 if __name__ == '__main__':