# Path: spline/lib/plugin/load.py
# def run_hooks(_spline_hook_name, *args, **kwargs):
#     """Runs the hooks registered for the given name, in priority order, passing
#     along all other arguments.
# 
#     If the hook is called outside the normal request cycle, such as with the
#     `routes_mapping` hook, then the `config` object must be explicitly passed
#     in.
# 
#     Current hooks:
# 
#     after_setup(config)
#         immediately following the Pylons environment setup
# 
#     routes_mapping(config, map)
#         near the end of Routes mapping, just before default routes are defined
# 
#     before_controller(action)
#         immediately before any controller is run
# 
#     after_controller()
#         immediately after any controller is run
#     """
# 
#     config = kwargs.get('config', pylons.config)
#     all_hooks = config['spline.plugins.hooks']
# 
#     if not _spline_hook_name in all_hooks:
#         # No hooks; bail
#         return []
#     hooks = all_hooks[_spline_hook_name]
# 
#     results = []
#     for priority in [1, 2, 3, 4, 5]:
#         if not priority in hooks:
#             # Nothing for this priority; bail
#             continue
# 
#         for function in hooks[priority]:
#             result = function(*args, **kwargs)
#             if result != None:
#                 results.append(result)
# 
#     return results
# 
# Path: spline/model/meta.py



from datetime import datetime, timedelta
from mako.runtime import capture
from pylons import cache, config, tmpl_context as c
from pylons.controllers import WSGIController
from pylons.templating import render_mako as render
from pylons.i18n.translation import set_lang
from sqlalchemy import event
from sqlalchemy.util import OrderedDict
from spline.lib.plugin.load import run_hooks
from spline.model import meta
import traceback
import zlib

    def __before__(self, action, **params):
        # Let templates get at the total render time
        c.timer = ResponseTimer()

        c.links = config['spline.plugins.links']
        c.javascripts = [
            ('spline', 'lib/jquery-1.7.1.min'),
            ('spline', 'lib/jquery.cookies-2.2.0.min'),
            ('spline', 'lib/jquery.ui-1.8.4.min'),
            ('spline', 'core'),
        ]
        run_hooks('before_controller', action, **params)

    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        c.lang = environ['pylons.routes_dict'].get('_lang')
        if c.lang:
            set_lang(c.lang)

        try:
            return WSGIController.__call__(self, environ, start_response)
        finally:
            meta.Session.remove()

    def __after__(self, **params):

# Path: spline/lib/plugin/load.py
# def run_hooks(_spline_hook_name, *args, **kwargs):
#     """Runs the hooks registered for the given name, in priority order, passing
#     along all other arguments.
# 
#     If the hook is called outside the normal request cycle, such as with the
#     `routes_mapping` hook, then the `config` object must be explicitly passed
#     in.
# 
#     Current hooks:
# 
#     after_setup(config)
#         immediately following the Pylons environment setup
# 
#     routes_mapping(config, map)
#         near the end of Routes mapping, just before default routes are defined
# 
#     before_controller(action)
#         immediately before any controller is run
# 
#     after_controller()
#         immediately after any controller is run
#     """
# 
#     config = kwargs.get('config', pylons.config)
#     all_hooks = config['spline.plugins.hooks']
# 
#     if not _spline_hook_name in all_hooks:
#         # No hooks; bail
#         return []
#     hooks = all_hooks[_spline_hook_name]
# 
#     results = []
#     for priority in [1, 2, 3, 4, 5]:
#         if not priority in hooks:
#             # Nothing for this priority; bail
#             continue
# 
#         for function in hooks[priority]:
#             result = function(*args, **kwargs)
#             if result != None:
#                 results.append(result)
# 
#     return results
# 
# Path: spline/model/meta.py



# Path: spline/lib/base.py
from datetime import datetime, timedelta
from mako.runtime import capture
from pylons import cache, config, tmpl_context as c
from pylons.controllers import WSGIController
from pylons.templating import render_mako as render
from pylons.i18n.translation import set_lang
from sqlalchemy import event
from sqlalchemy.util import OrderedDict
from spline.lib.plugin.load import run_hooks
from spline.model import meta
import traceback
import zlib


    def __before__(self, action, **params):
        # Let templates get at the total render time
        c.timer = ResponseTimer()

        c.links = config['spline.plugins.links']
        c.javascripts = [
            ('spline', 'lib/jquery-1.7.1.min'),
            ('spline', 'lib/jquery.cookies-2.2.0.min'),
            ('spline', 'lib/jquery.ui-1.8.4.min'),
            ('spline', 'core'),
        ]
        run_hooks('before_controller', action, **params)

    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        c.lang = environ['pylons.routes_dict'].get('_lang')
        if c.lang:
            set_lang(c.lang)

        try:
            return WSGIController.__call__(self, environ, start_response)
        finally:
            meta.Session.remove()

    def __after__(self, **params):

        run_hooks('after_controller', **params)