Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(20)  |  Call(0)  |  Derive(0)  |  Import(20)
Simple expose decorator for controller actions.

Transparently wraps a method in a function that will render the method's
return value with the given template.

Sets the 'exposed' and 'template' attributes of the wrapped method,
marking it as safe to be accessed via HTTP request.

Example, using a genshi template::
(more...)

        def expose(template='string', request_method=None, permission=None):
    """Simple expose decorator for controller actions.

    Transparently wraps a method in a function that will render the method's
    return value with the given template.

    Sets the 'exposed' and 'template' attributes of the wrapped method,
    marking it as safe to be accessed via HTTP request.

    Example, using a genshi template::

        class MyController(BaseController):

            @expose('path/to/template.html')
            def sample_action(self, *args):
                # do something
                return dict(message='Hello World!')

    :param template:
        One of:
            * The path to a genshi template, relative to the project's
              template directory
            * 'string'
            * 'json'
    :type template: string or unicode

    :param request_method: Optional request method to verify. If GET or
        POST is given and the method of the current request does not match,
        a 405 Method Not Allowed error is raised.

    """
    def wrap(f):
        wrapped_f = _expose_wrapper(f, template, request_method, permission)
        _copy_func_attrs(f, wrapped_f)
        return wrapped_f
    return wrap
        


src/m/e/mediadrop-HEAD/mediadrop/controllers/admin/media.py   mediadrop(Download)
from mediadrop.lib.auth import has_permission
from mediadrop.lib.base import BaseController
from mediadrop.lib.decorators import (autocommit, expose, expose_xhr,
    observable, paginate, validate, validate_xhr)
from mediadrop.lib.helpers import redirect, url_for

src/m/e/mediadrop-HEAD/mediadrop/controllers/admin/users.py   mediadrop(Download)
from mediadrop.lib.auth import has_permission
from mediadrop.lib.base import BaseController
from mediadrop.lib.decorators import (autocommit, expose, expose_xhr,
    observable, paginate, validate)
from mediadrop.lib.helpers import redirect, url_for

src/m/e/mediadrop-HEAD/mediadrop/controllers/admin/podcasts.py   mediadrop(Download)
from mediadrop.lib.auth import has_permission
from mediadrop.lib.base import BaseController
from mediadrop.lib.decorators import (autocommit, expose, expose_xhr,
    observable, paginate, validate)
from mediadrop.lib.helpers import redirect, url_for

src/m/e/mediadrop-HEAD/mediadrop/controllers/media.py   mediadrop(Download)
from mediadrop.lib import helpers
from mediadrop.lib.base import BaseController
from mediadrop.lib.decorators import expose, expose_xhr, observable, paginate, validate_xhr, autocommit
from mediadrop.lib.email import send_comment_notification
from mediadrop.lib.helpers import (filter_vulgarity, redirect, url_for, 

src/m/e/mediadrop-HEAD/mediadrop/controllers/api/media.py   mediadrop(Download)
from mediadrop.lib import helpers
from mediadrop.lib.base import BaseController
from mediadrop.lib.decorators import expose, expose_xhr, observable, paginate, validate
from mediadrop.lib.helpers import get_featured_category, url_for, url_for_media
from mediadrop.lib.thumbnails import thumb

src/m/e/mediadrop-HEAD/mediadrop/controllers/admin/tags.py   mediadrop(Download)
from mediadrop.lib.auth import has_permission
from mediadrop.lib.base import BaseController
from mediadrop.lib.decorators import (autocommit, expose, observable, paginate, 
    validate)
from mediadrop.lib.helpers import redirect

src/m/e/mediadrop-HEAD/mediadrop/controllers/admin/groups.py   mediadrop(Download)
from mediadrop.lib.auth import has_permission
from mediadrop.lib.base import BaseController
from mediadrop.lib.decorators import (autocommit, expose, observable, paginate, validate)
from mediadrop.lib.helpers import redirect, url_for
from mediadrop.model import fetch_row, Group, Permission

src/m/e/mediadrop-HEAD/mediadrop/controllers/admin/comments.py   mediadrop(Download)
from mediadrop.lib.auth import has_permission
from mediadrop.lib.base import BaseController
from mediadrop.lib.decorators import (autocommit, expose, expose_xhr,
    observable, paginate)
from mediadrop.lib.helpers import redirect, url_for

src/m/e/mediadrop-HEAD/mediadrop/controllers/admin/categories.py   mediadrop(Download)
from mediadrop.lib.auth import has_permission
from mediadrop.lib.base import BaseController
from mediadrop.lib.decorators import (autocommit, expose, observable, paginate, 
    validate)
from mediadrop.lib.helpers import redirect, url_for

src/m/e/mediadrop-HEAD/mediadrop/controllers/podcasts.py   mediadrop(Download)
from mediadrop.lib import helpers
from mediadrop.lib.base import BaseController
from mediadrop.lib.decorators import (beaker_cache, expose, observable, 
    paginate, validate)
from mediadrop.lib.helpers import content_type_for_response, url_for, redirect

  1 | 2  Next