media_change
  /   ˆ{‹„„-i[D<†ªoZƒ›Ù«Â525_‘I|¥‰ÓMdœv ©ƒ†ü+=ÂÁ     ‹      Õ•QoÚ0Çßû)<?ì.ÖjÔñÔ¤¡Q@”iš¦irbC¬&6²”}ú9$V•­Ó6­{òùò÷Ýý.‰�<‹Ç½Ù‡I½™]ÑäÝëá ‡pà}»ÏâêA§„ ýF8snÙØl6ÍM»©ÍfSÈ\‘wÀ:#S×äŽczFJ=C$Œû'].è@qq‡ô�^9+¹ðç¶¸XËTØÒv¢€BÚlë%.@i.‚z‚]%•’@Ö'‚:I4ß–„>™�¹CaÉ.giJ\†Ö,—a§—˜Y,�5i„A¦ZYHr¦n›9Çˆå.Â½ñ'¯—•§)a(3báW½ht9ŽbLG¬ØÃšk¯¹ÂtÈ¬C…ær.?)¾©Ä7òËé€q¥‰…M�\:©ÕA
ñ5Õ¹]2ÏúÂdæXUIøÏºÁÒïš1¹šöG³x0­ZÂË‡ê~ëÕa:aF(‡biDê¼³æª’<W‰]^î·¨®ÚÈEæ0E¨�Tþê\ç\˜cØS˜{0L÷Öq¥÷Jk­óF6Â—(¼èç=#×Âìjë©0¬Ô­Òuá¿èA|f+ÊèD|£9¸�Õj£ ìvÚ'±ü�úö`ÝCú_qVbíkL«õï<òþƒz2Ø!Õü
ªì³<h    C   ˆl–Ðz¾”Šj"Tâ‚À½q¶”Å£�þEo¬ãe#qº•à?Å„@û¿Ä_ŠI|¥�+Wé3ž¯ÄÃ +Y    """Native adapter for serving CherryPy via mod_python.

Basic usage:

##########################################
# Application in a module called myapp.py
##########################################

import cherrypy

class Root:
    @cherrypy.expose
    def index(self):
        return 'Hi there, Ho there, Hey there'


# We will use this method from the mod_python configuration
# as the entry point to our application
def setup_server():
    cherrypy.tree.mount(Root())
    cherrypy.config.update({'environment': 'production',
                            'log.screen': False,
                            'show_tracebacks': False})

##########################################
# mod_python settings for apache2
# This should reside in your httpd.conf
# or a file that will be loaded at
# apache startup
##########################################

# Start
DocumentRoot "/"
Listen 8080
LoadModule python_module /usr/lib/apache2/modules/mod_python.so

<Location "/">
    PythonPath "sys.path+['/path/to/my/application']"
    SetHandler python-program
    PythonHandler cherrypy._cpmodpy::handler
    PythonOption cherrypy.setup myapp::setup_server
    PythonDebug On
</Location>
# End

The actual path to your mod_python.so is dependent on your
environment. In this case we suppose a global mod_python
installation on a Linux distribution such as Ubuntu.

We do set the PythonPath configuration setting so that
your application can be found by from the user running
the apache2 instance. Of course if your application
resides in the global site-package this won't be needed.

Then restart apache2 and access http://127.0.0.1:8080
"""

import io
import logging
import os
import re
import sys

from more_itertools import always_iterable

import cherrypy
from cherrypy._cperror import format_exc, bare_error
from cherrypy.lib import httputil


# ------------------------------ Request-handling


def setup(req):
    from mod_python import apache

    # Run any setup functions defined by a "PythonOption cherrypy.setup"
    # directive.
    options = req.get_options()
    if 'cherrypy.setup' in options:
        for function in options['cherrypy.setup'].split():
            atoms = function.split('::', 1)
            if len(atoms) == 1:
                mod = __import__(atoms[0], globals(), locals())
            else:
                modname, fname = atoms
                mod = __import__(modname, globals(), locals(), [fname])
                func = getattr(mod, fname)
                func()

    cherrypy.config.update({'log.screen': False,
                            'tools.ignore_headers.on': True,
                            'tools.ignore_headers.headers': ['Range'],
                            })

    engine = cherrypy.engine
    if hasattr(engine, 'signal_handler'):
        engine.signal_handler.unsubscribe()
    if hasattr(engine, 'console_control_handler'):
        engine.console_control_handler.unsubscribe()
    engine.autoreload.unsubscribe()
    cherrypy.server.unsubscribe()

    @engine.subscribe('log')
    def _log(msg, level):
        newlevel = apache.APLOG_ERR
        if logging.DEBUG >= level:
            newlevel = apache.APLOG_DEBUG
        elif logging.INFO >= level:
            newlevel = apache.APLOG_INFO
        elif logging.WARNING >= level:
            newlevel = apache.APLOG_WARNING
        # On Windows, req.server is required or the msg will vanish. See
        # h