# Path: elixir_models.py
# def setup(db_uri='simplemmo.sqlite', echo=False):
#     print "dburi:", db_uri
#     global db
#     db.init(db_uri)
#     db.connect()
#     db.create_tables([User, Character, Zone, Message, Object], True)


import settings
import logging
        import requests
        import os
        import uuid
from tornado.web import Application, RequestHandler
from tornado.options import options, define
from tornado.ioloop import IOLoop
from elixir_models import setup
        from raven import Client
                from raven.handlers.logging import SentryHandler
                from raven.conf import setup_logging
from subprocess import Popen, PIPE
        from zipfile import ZipFile

    '''
    def get(self):
        self.write("pong")
        self.set_header("Content-Type", "text/plain")

class BaseServer(Application):
    def __init__(self, extra_handlers):
        '''Expects a list of tuple handlers like:
                [(r"/", MainHandler), (r"/chatsocket", ChatSocketHandler),]
        '''
        url = settings._server_str % (settings.PROTOCOL, settings.HOSTNAME, settings.AUTHSERVERPORT)

        app_settings = {
                "cookie_secret": settings.COOKIE_SECRET,
                "login_url": ''.join((url, "/login")),
                }

        handlers = []
        handlers.append((r"/version", VersionHandler))
        handlers.append((r"/source", SelfServe))
        handlers.append((r"/ping", PingHandler))
        handlers.append((r"/", PingHandler))

        handlers.extend(extra_handlers)

        options.parse_command_line()
        dburi = options.dburi

        # Connect to the elixir db

# Path: elixir_models.py
# def setup(db_uri='simplemmo.sqlite', echo=False):
#     print "dburi:", db_uri
#     global db
#     db.init(db_uri)
#     db.connect()
#     db.create_tables([User, Character, Zone, Message, Object], True)


# Path: baseserver.py
import settings
import logging
        import requests
        import os
        import uuid
from tornado.web import Application, RequestHandler
from tornado.options import options, define
from tornado.ioloop import IOLoop
from elixir_models import setup
        from raven import Client
                from raven.handlers.logging import SentryHandler
                from raven.conf import setup_logging
from subprocess import Popen, PIPE
        from zipfile import ZipFile


    '''
    def get(self):
        self.write("pong")
        self.set_header("Content-Type", "text/plain")

class BaseServer(Application):
    def __init__(self, extra_handlers):
        '''Expects a list of tuple handlers like:
                [(r"/", MainHandler), (r"/chatsocket", ChatSocketHandler),]
        '''
        url = settings._server_str % (settings.PROTOCOL, settings.HOSTNAME, settings.AUTHSERVERPORT)

        app_settings = {
                "cookie_secret": settings.COOKIE_SECRET,
                "login_url": ''.join((url, "/login")),
                }

        handlers = []
        handlers.append((r"/version", VersionHandler))
        handlers.append((r"/source", SelfServe))
        handlers.append((r"/ping", PingHandler))
        handlers.append((r"/", PingHandler))

        handlers.extend(extra_handlers)

        options.parse_command_line()
        dburi = options.dburi

        # Connect to the elixir db

        setup(db_uri=dburi)