# Path: web/net.py
# def websafe(val):
#     r"""
#     Converts `val` so that it is safe for use in Unicode HTML.
# 
#         >>> websafe("<'&\">")
#         u'&lt;&#39;&amp;&quot;&gt;'
#         >>> websafe(None)
#         u''
#         >>> websafe(u'\u203d') == u'\u203d'
#         True
#     """
#     if val is None:
#         return u""
# 
#     if isinstance(val, bytes):
#         val = val.decode("utf-8")
#     elif not isinstance(val, str):
#         val = str(val)
# 
#     return htmlquote(val)


import ast
import glob
import os
import sys
import tokenize
import builtins
        import re
        import types
        import types
        import doctest
from io import open
from .net import websafe
from .utils import re_compile, safestr, safeunicode, storage
from .webapi import config
from collections.abc import MutableMapping
            from token import NAME  # python token constants
        from . import webapi as web
    from google import appengine  # noqa: F401

    def make_env(self, globals, builtins):
        return dict(
            globals,
            __builtins__=builtins,
            ForLoop=ForLoop,
            TemplateResult=TemplateResult,
            escape_=self._escape,
            join_=self._join,
        )

    def _join(self, *items):
        return u"".join(items)

    def _escape(self, value, escape=False):
        if value is None:
            value = ""

        value = safeunicode(value)
        if escape and self.filter:
            value = self.filter(value)
        return value


class Template(BaseTemplate):
    CONTENT_TYPES = {
        ".html": "text/html; charset=utf-8",
        ".xhtml": "application/xhtml+xml; charset=utf-8",
        ".txt": "text/plain",
    }

# Path: web/net.py
# def websafe(val):
#     r"""
#     Converts `val` so that it is safe for use in Unicode HTML.
# 
#         >>> websafe("<'&\">")
#         u'&lt;&#39;&amp;&quot;&gt;'
#         >>> websafe(None)
#         u''
#         >>> websafe(u'\u203d') == u'\u203d'
#         True
#     """
#     if val is None:
#         return u""
# 
#     if isinstance(val, bytes):
#         val = val.decode("utf-8")
#     elif not isinstance(val, str):
#         val = str(val)
# 
#     return htmlquote(val)


# Path: web/template.py
import ast
import glob
import os
import sys
import tokenize
import builtins
        import re
        import types
        import types
        import doctest
from io import open
from .net import websafe
from .utils import re_compile, safestr, safeunicode, storage
from .webapi import config
from collections.abc import MutableMapping
            from token import NAME  # python token constants
        from . import webapi as web
    from google import appengine  # noqa: F401


    def make_env(self, globals, builtins):
        return dict(
            globals,
            __builtins__=builtins,
            ForLoop=ForLoop,
            TemplateResult=TemplateResult,
            escape_=self._escape,
            join_=self._join,
        )

    def _join(self, *items):
        return u"".join(items)

    def _escape(self, value, escape=False):
        if value is None:
            value = ""

        value = safeunicode(value)
        if escape and self.filter:
            value = self.filter(value)
        return value


class Template(BaseTemplate):
    CONTENT_TYPES = {
        ".html": "text/html; charset=utf-8",
        ".xhtml": "application/xhtml+xml; charset=utf-8",
        ".txt": "text/plain",
    }

    FILTERS = {".html": websafe, ".xhtml": websafe, ".xml": websafe}