# Path: pylons/controllers/util.py
# def abort(status_code=None, detail="", headers=None, comment=None):
#     """Aborts the request immediately by returning an HTTP exception
#     
#     In the event that the status_code is a 300 series error, the detail
#     attribute will be used as the Location header should one not be
#     specified in the headers attribute.
#     
#     """
#     exc = status_map[status_code](detail=detail, headers=headers, 
#                                   comment=comment)
#     log.debug("Aborting request, status: %s, detail: %r, headers: %r, "
#               "comment: %r", status_code, detail, headers, comment)
#     raise exc.exception
# 
# def redirect(url, code=302):
#     """Raises a redirect exception to the specified URL
# 
#     Optionally, a code variable may be passed with the status code of
#     the redirect, ie::
# 
#         redirect(url(controller='home', action='index'), code=303)
# 
#     """
#     log.debug("Generating %s redirect" % code)
#     exc = status_map[code]
#     raise exc(location=url).exception


import logging
import urlparse
    import webhelpers.html.secure_form as secure_form
    import webhelpers.pylonslib.secure_form as secure_form
from decorator import decorator
from pylons.controllers.util import abort, redirect
from pylons.decorators.util import get_pylons
            do_secure()

        # redirect to HTTPS version of myself
        @https()
        def get(self):
            do_secure()

    """
    def wrapper(func, *args, **kwargs):
        """Decorator Wrapper function"""
        request = get_pylons(args).request
        if request.scheme.lower() == 'https':
            return func(*args, **kwargs)
        if request.method.upper() == 'POST':
            # don't allow POSTs (raises an exception)
            abort(405, headers=[('Allow', 'GET')])

        if url_or_callable is None:
            url = request.url
        elif callable(url_or_callable):
            url = url_or_callable()
        else:
            url = url_or_callable
        # Ensure an https scheme, which also needs a host
        parts = urlparse.urlparse(url)
        url = urlparse.urlunparse(('https', parts[1] or request.host) +
                                  parts[2:])

        log.debug('Redirecting non-https request: %s to: %s',
                  request.path_info, url)

# Path: pylons/controllers/util.py
# def abort(status_code=None, detail="", headers=None, comment=None):
#     """Aborts the request immediately by returning an HTTP exception
#     
#     In the event that the status_code is a 300 series error, the detail
#     attribute will be used as the Location header should one not be
#     specified in the headers attribute.
#     
#     """
#     exc = status_map[status_code](detail=detail, headers=headers, 
#                                   comment=comment)
#     log.debug("Aborting request, status: %s, detail: %r, headers: %r, "
#               "comment: %r", status_code, detail, headers, comment)
#     raise exc.exception
# 
# def redirect(url, code=302):
#     """Raises a redirect exception to the specified URL
# 
#     Optionally, a code variable may be passed with the status code of
#     the redirect, ie::
# 
#         redirect(url(controller='home', action='index'), code=303)
# 
#     """
#     log.debug("Generating %s redirect" % code)
#     exc = status_map[code]
#     raise exc(location=url).exception


# Path: pylons/decorators/secure.py
import logging
import urlparse
    import webhelpers.html.secure_form as secure_form
    import webhelpers.pylonslib.secure_form as secure_form
from decorator import decorator
from pylons.controllers.util import abort, redirect
from pylons.decorators.util import get_pylons

            do_secure()

        # redirect to HTTPS version of myself
        @https()
        def get(self):
            do_secure()

    """
    def wrapper(func, *args, **kwargs):
        """Decorator Wrapper function"""
        request = get_pylons(args).request
        if request.scheme.lower() == 'https':
            return func(*args, **kwargs)
        if request.method.upper() == 'POST':
            # don't allow POSTs (raises an exception)
            abort(405, headers=[('Allow', 'GET')])

        if url_or_callable is None:
            url = request.url
        elif callable(url_or_callable):
            url = url_or_callable()
        else:
            url = url_or_callable
        # Ensure an https scheme, which also needs a host
        parts = urlparse.urlparse(url)
        url = urlparse.urlunparse(('https', parts[1] or request.host) +
                                  parts[2:])

        log.debug('Redirecting non-https request: %s to: %s',
                  request.path_info, url)

        redirect(url)