# Path: web/view/recommendations.py
# class RecommendationHandler(util.SnowballHandler):
# class RecommendationSetHandler(util.SnowballHandler):
#     def get(self, from_uri, to_uri):
#     def get(self, uri):
# 
# Path: web/view/links.py
# class LinkHandler(util.SnowballHandler):
# class LinkSetHandler(util.SnowballHandler):
#     def get(self, from_node, to_node):
#     def put(self, from_node, to_node):
#     def delete(self, from_node, to_node):
#     def get_from(self, uri):
#     def get_to(self, uri):
#     def get(self, uri):
#     def delete_from(self, uri):
#     def delete_to(self, uri):
#     def delete(self, uri):
# 
# Path: web/view/nodes.py
# def put_node(request, uri):
#     def get(self, uri):
#     def put(self, uri):
#     def delete(self, uri):
#     def post(self):
# class NodeHandler(util.SnowballHandler):
# class PostNodeHandler(util.SnowballHandler):
# 
# Path: web/view/tags.py
# class TagHandler(util.SnowballHandler):
#     def get(self, uri):
#     def put(self, uri):
#     def delete(self, uri):
# 
# Path: web/view/error.py
# class ErrorHandler(util.SnowballHandler):
#     def head(self, path):
#     def get(self, path):
#     def post(self, path):
#     def delete(self, from_node, to_node):
#     def put(self, from_node, to_node):
# 
# Path: web/admin/admin.py
# REALM = 'Administrator Control Panel'
# def admin_auth(req, realm, name, password):
#     def get(self, path):
#     def put(self, path):
#     def delete(self, path):
# class AdminHandler(util.SnowballHandler):


import sys, os
import tornado.web
import logging, model, settings_parser, os
        import tornado.wsgi
        import wsgiref.handlers
        import tornado.httpserver
        import tornado.ioloop
from web.view import recommendations, links, nodes, tags, error
from web.admin import admin
            
    #This setting means that clients can set an error_format parameter to control the format of error outputs
    parser.settings['output_type_override'] = 'error_format'
    
    #Store a connection to the database in the settings
    parser.settings['db'] = db
    
    #Tornado setting for the path to static files
    parser.settings['static_path'] = os.path.join(os.path.dirname(__file__), 'web/static')
    
    routes = [
        (r'^/recommendations/(.+)/(.+)$', recommendations.RecommendationHandler),
        (r'^/recommendations/(.+)$', recommendations.RecommendationSetHandler),
        
        (r'^/links/(.+)/(.+)$', links.LinkHandler),
        (r'^/links/(.+)$', links.LinkSetHandler),
        
        (r'^/tags/(.+)/(.+)$', tags.TagHandler),
        (r'^/tags/(.+)$', tags.TagHandler),
        (r'^/tags$', tags.TagHandler),
        
        (r'^/nodes/(.+)$', nodes.NodeHandler),
        (r'^/nodes$', nodes.PostNodeHandler),
    ]
    
    #Conditional endpoints
    if admin_enabled:
        routes.append((r'/admin(.*)$', admin.AdminHandler))
        
    #Error endpoint

# Path: web/view/recommendations.py
# class RecommendationHandler(util.SnowballHandler):
# class RecommendationSetHandler(util.SnowballHandler):
#     def get(self, from_uri, to_uri):
#     def get(self, uri):
# 
# Path: web/view/links.py
# class LinkHandler(util.SnowballHandler):
# class LinkSetHandler(util.SnowballHandler):
#     def get(self, from_node, to_node):
#     def put(self, from_node, to_node):
#     def delete(self, from_node, to_node):
#     def get_from(self, uri):
#     def get_to(self, uri):
#     def get(self, uri):
#     def delete_from(self, uri):
#     def delete_to(self, uri):
#     def delete(self, uri):
# 
# Path: web/view/nodes.py
# def put_node(request, uri):
#     def get(self, uri):
#     def put(self, uri):
#     def delete(self, uri):
#     def post(self):
# class NodeHandler(util.SnowballHandler):
# class PostNodeHandler(util.SnowballHandler):
# 
# Path: web/view/tags.py
# class TagHandler(util.SnowballHandler):
#     def get(self, uri):
#     def put(self, uri):
#     def delete(self, uri):
# 
# Path: web/view/error.py
# class ErrorHandler(util.SnowballHandler):
#     def head(self, path):
#     def get(self, path):
#     def post(self, path):
#     def delete(self, from_node, to_node):
#     def put(self, from_node, to_node):
# 
# Path: web/admin/admin.py
# REALM = 'Administrator Control Panel'
# def admin_auth(req, realm, name, password):
#     def get(self, path):
#     def put(self, path):
#     def delete(self, path):
# class AdminHandler(util.SnowballHandler):


# Path: server.py
import sys, os
import tornado.web
import logging, model, settings_parser, os
        import tornado.wsgi
        import wsgiref.handlers
        import tornado.httpserver
        import tornado.ioloop
from web.view import recommendations, links, nodes, tags, error
from web.admin import admin

            
    #This setting means that clients can set an error_format parameter to control the format of error outputs
    parser.settings['output_type_override'] = 'error_format'
    
    #Store a connection to the database in the settings
    parser.settings['db'] = db
    
    #Tornado setting for the path to static files
    parser.settings['static_path'] = os.path.join(os.path.dirname(__file__), 'web/static')
    
    routes = [
        (r'^/recommendations/(.+)/(.+)$', recommendations.RecommendationHandler),
        (r'^/recommendations/(.+)$', recommendations.RecommendationSetHandler),
        
        (r'^/links/(.+)/(.+)$', links.LinkHandler),
        (r'^/links/(.+)$', links.LinkSetHandler),
        
        (r'^/tags/(.+)/(.+)$', tags.TagHandler),
        (r'^/tags/(.+)$', tags.TagHandler),
        (r'^/tags$', tags.TagHandler),
        
        (r'^/nodes/(.+)$', nodes.NodeHandler),
        (r'^/nodes$', nodes.PostNodeHandler),
    ]
    
    #Conditional endpoints
    if admin_enabled:
        routes.append((r'/admin(.*)$', admin.AdminHandler))
        
    #Error endpoint

    routes.append((r'^(?!\/static\/)(.*)$', error.ErrorHandler))