# Path: dokomoforms/options.py
# def inject_options(**kwargs):
# def parse_options():


import os
import textwrap
import signal
import subprocess
import sys
import logging
import mimetypes
import tornado.log
import tornado.httpserver
import tornado.web
import dokomoforms.handlers as handlers
from time import sleep
from sqlalchemy import DDL
from sqlalchemy.orm import sessionmaker
from tornado.web import url
from dokomoforms.options import options
    from dokomoforms.options import parse_options
from dokomoforms.models import create_engine, Base, UUID_REGEX
from dokomoforms.handlers.api.v0 import (
    SurveyResource, SubmissionResource, PhotoResource, NodeResource,
    UserResource
)
            from dokomoforms.handlers.debug import revisit_debug
    the file doesn't exist, the script will exit with code 1 and tell the
    user how to generate it.

    :return: the cookie secret as bytes
    """
    try:
        with open(os.path.join(_pwd, 'cookie_secret'), 'rb') as cookie_file:
            cookie_secret = cookie_file.read()
        return cookie_secret
    except IOError:
        print(textwrap.fill(
            '{error} no secret key found for creating secure user session'
            ' cookies. Create it by running the following command:'.format(
                error=modify_text('Error:', bold)
            )
        ))
        print('head -c 24 /dev/urandom > cookie_secret')
        sys.exit(1)


def ensure_that_user_wants_to_drop_schema():
    """Check that user asked to drop the schema intentionally.

    Interrogates the user to make sure that the schema specified by
    options.schema should be dropped. If the user decides against it,
    exits the application.
    """
    answer = input(textwrap.fill(
        'Do you really want to drop the schema {schema}? Doing so will {erase}'
        ' all the data {permanently} y/n (default n)'.format(

# Path: dokomoforms/options.py
# def inject_options(**kwargs):
# def parse_options():


# Path: webapp.py
import os
import textwrap
import signal
import subprocess
import sys
import logging
import mimetypes
import tornado.log
import tornado.httpserver
import tornado.web
import dokomoforms.handlers as handlers
from time import sleep
from sqlalchemy import DDL
from sqlalchemy.orm import sessionmaker
from tornado.web import url
from dokomoforms.options import options
    from dokomoforms.options import parse_options
from dokomoforms.models import create_engine, Base, UUID_REGEX
from dokomoforms.handlers.api.v0 import (
    SurveyResource, SubmissionResource, PhotoResource, NodeResource,
    UserResource
)
            from dokomoforms.handlers.debug import revisit_debug

    the file doesn't exist, the script will exit with code 1 and tell the
    user how to generate it.

    :return: the cookie secret as bytes
    """
    try:
        with open(os.path.join(_pwd, 'cookie_secret'), 'rb') as cookie_file:
            cookie_secret = cookie_file.read()
        return cookie_secret
    except IOError:
        print(textwrap.fill(
            '{error} no secret key found for creating secure user session'
            ' cookies. Create it by running the following command:'.format(
                error=modify_text('Error:', bold)
            )
        ))
        print('head -c 24 /dev/urandom > cookie_secret')
        sys.exit(1)


def ensure_that_user_wants_to_drop_schema():
    """Check that user asked to drop the schema intentionally.

    Interrogates the user to make sure that the schema specified by
    options.schema should be dropped. If the user decides against it,
    exits the application.
    """
    answer = input(textwrap.fill(
        'Do you really want to drop the schema {schema}? Doing so will {erase}'
        ' all the data {permanently} y/n (default n)'.format(

            schema=options.schema,