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

All Samples(2)  |  Call(0)  |  Derive(0)  |  Import(2)
Register new permission. 

        def Permission(name, title, description=''):
    """ Register new permission. """
    info = config.DirectiveInfo()

    permission = PermissionInfo(name)
    permission.title = title
    permission.description = description

    discr = (ID_PERMISSION, name)
    intr = config.Introspectable(ID_PERMISSION, discr, title, 'ptah-permission')
    intr['permission'] = permission
    intr['module'] = info.module.__name__
    intr['codeinfo'] = info.codeinfo

    info.attach(
        config.Action(
            lambda config, p: \
                config.get_cfg_storage(ID_PERMISSION).update({str(p): p}),
            (permission,), discriminator=discr, introspectables=(intr,))
        )

    return permission
        


src/p/t/ptah-0.8.0/ptah/__init__.py   ptah(Download)
 
# permission
from ptah.security import Permission
from ptah.security import get_permissions
from ptah.security import check_permission

src/p/t/ptah-HEAD/ptah/__init__.py   ptah(Download)
 
# permission
from ptah.security import Permission
from ptah.security import get_permissions
from ptah.security import check_permission