def arguments(*args):
    """A Decorator which you wrap around a function or a method to indicate
    which magical objects you want passed to your functions which are
    embedded in a Resource's template.

    The magical values you can pass are:
        LOCATION
        REQUEST
        SITE
        RESOURCE
        METHOD
        URI

    For example, to pass a function the SiteMap instance, do this:

        @arguments(SITE)
        def foo(site):
            print "The site!"

    The values which you pass a string argument to get variables out of the
    request environment (which also take a default) are:

        QUERY
        QUERIES
        ARG
        ARGS
        COOKIE
        HEADER

    For example, to pass a query parameter to a function, with a default
    if the parameter is not present, do this:

        @arguments(QUERY('foo', 'default'))
        def foo(foo):
            print foo

    All the magic objects which take string values have a __getattr__
    implementation for syntatic convenience when you do not need to
    pass a default value (None will be used as the default value):

        @arguments(QUERY.foo)
        def foo(foo):
            print foo
    """
    def decorate(func):
        func.arguments = args
        return func
    return decorate