# Path: fuzzinator/pkgdata.py



import logging
import mimetypes
import pkgutil
import threading
import traceback
from urllib.parse import urljoin, urlparse, urlunparse
from bson.json_util import dumps, RELAXED_JSON_OPTIONS
from markdown import markdown
from tornado.template import BaseLoader, Template
from tornado.web import HTTPError, RequestHandler
from tornado.websocket import WebSocketHandler
from ...config import config_get_object
from ...formatter import JsonFormatter
from ...pkgdata import __version__
from ...tracker import TrackerError
        self._wui.register_ws(self)

    # Invoked when the WebSocket is closed.
    def on_close(self):
        self._wui.unregister_ws(self)

    # Sends the given message to the client of this WebSocket.
    def send_notification(self, action, data):
        try:
            self.write_message(dumps({'action': action, 'data': data}, json_options=RELAXED_JSON_OPTIONS))
        except Exception as e:
            logger.error('Exception in send_message: %s %s', action, data, exc_info=e)
            self.on_close()
            self.close()


class BaseUIHandler(RequestHandler):

    def initialize(self, wui):
        self._wui = wui

    @property
    def _db(self):
        return self._wui.controller.db

    @property
    def _config(self):
        return self._wui.controller.config

    def render(self, *args, **kwargs):

# Path: fuzzinator/pkgdata.py



# Path: fuzzinator/ui/wui/ui_handlers.py
import logging
import mimetypes
import pkgutil
import threading
import traceback
from urllib.parse import urljoin, urlparse, urlunparse
from bson.json_util import dumps, RELAXED_JSON_OPTIONS
from markdown import markdown
from tornado.template import BaseLoader, Template
from tornado.web import HTTPError, RequestHandler
from tornado.websocket import WebSocketHandler
from ...config import config_get_object
from ...formatter import JsonFormatter
from ...pkgdata import __version__
from ...tracker import TrackerError

        self._wui.register_ws(self)

    # Invoked when the WebSocket is closed.
    def on_close(self):
        self._wui.unregister_ws(self)

    # Sends the given message to the client of this WebSocket.
    def send_notification(self, action, data):
        try:
            self.write_message(dumps({'action': action, 'data': data}, json_options=RELAXED_JSON_OPTIONS))
        except Exception as e:
            logger.error('Exception in send_message: %s %s', action, data, exc_info=e)
            self.on_close()
            self.close()


class BaseUIHandler(RequestHandler):

    def initialize(self, wui):
        self._wui = wui

    @property
    def _db(self):
        return self._wui.controller.db

    @property
    def _config(self):
        return self._wui.controller.config

    def render(self, *args, **kwargs):

        super().render(*args, version=__version__, **kwargs)