当前位置: 首页>>代码示例>>Python>>正文


Python Space.bag_is_public方法代码示例

本文整理汇总了Python中tiddlywebplugins.tiddlyspace.space.Space.bag_is_public方法的典型用法代码示例。如果您正苦于以下问题:Python Space.bag_is_public方法的具体用法?Python Space.bag_is_public怎么用?Python Space.bag_is_public使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tiddlywebplugins.tiddlyspace.space.Space的用法示例。


在下文中一共展示了Space.bag_is_public方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_bag_is

# 需要导入模块: from tiddlywebplugins.tiddlyspace.space import Space [as 别名]
# 或者: from tiddlywebplugins.tiddlyspace.space.Space import bag_is_public [as 别名]
def test_bag_is():
    assert Space.bag_is_public('cat_public')
    assert not Space.bag_is_public('cat_private')
    assert not Space.bag_is_public('_public')
    assert Space.bag_is_private('cat_private')
    assert not Space.bag_is_private('cat_public')
    assert not Space.bag_is_private('_private')
开发者ID:Alanchi,项目名称:tiddlyspace,代码行数:9,代码来源:test_space_object.py

示例2: _make_space

# 需要导入模块: from tiddlywebplugins.tiddlyspace.space import Space [as 别名]
# 或者: from tiddlywebplugins.tiddlyspace.space.Space import bag_is_public [as 别名]
def _make_space(environ, space_name):
    """
    The details of creating the bags and recipes that make up a space.
    """
    store = environ['tiddlyweb.store']
    member = environ['tiddlyweb.usersign']['name']

    # XXX stub out the clumsy way for now
    # can make this much more declarative

    space = Space(space_name)

    for bag_name in space.list_bags():
        bag = Bag(bag_name)
        bag.policy = _make_policy(member)
        if Space.bag_is_public(bag_name):
            bag.policy.read = []
        store.put(bag)

    public_recipe = Recipe(space.public_recipe())
    public_recipe.set_recipe(space.public_recipe_list())
    private_recipe = Recipe(space.private_recipe())
    private_recipe.set_recipe(space.private_recipe_list())
    private_recipe.policy = _make_policy(member)
    public_recipe.policy = _make_policy(member)
    public_recipe.policy.read = []
    store.put(public_recipe)
    store.put(private_recipe)
开发者ID:carnotip,项目名称:tiddlyspace,代码行数:30,代码来源:spaces.py

示例3: make_space

# 需要导入模块: from tiddlywebplugins.tiddlyspace.space import Space [as 别名]
# 或者: from tiddlywebplugins.tiddlyspace.space.Space import bag_is_public [as 别名]
def make_space(space_name, store, member):
    """
    The details of creating the bags and recipes that make up a space.
    """
    space = Space(space_name)

    for bag_name in space.list_bags():
        bag = Bag(bag_name)
        bag.policy = _make_policy(member)
        if Space.bag_is_public(bag_name):
            bag.policy.read = []
        store.put(bag)

    info_tiddler = Tiddler('SiteInfo', space.public_bag())
    info_tiddler.text = 'Space %s' % space_name
    store.put(info_tiddler)

    public_recipe = Recipe(space.public_recipe())
    public_recipe.set_recipe(space.public_recipe_list())
    private_recipe = Recipe(space.private_recipe())
    private_recipe.set_recipe(space.private_recipe_list())
    private_recipe.policy = _make_policy(member)
    public_recipe.policy = _make_policy(member)
    public_recipe.policy.read = []
    store.put(public_recipe)
    store.put(private_recipe)
开发者ID:ramanathanr,项目名称:tiddlyspace,代码行数:28,代码来源:spaces.py

示例4: _valid_bag

# 需要导入模块: from tiddlywebplugins.tiddlyspace.space import Space [as 别名]
# 或者: from tiddlywebplugins.tiddlyspace.space.Space import bag_is_public [as 别名]
    def _valid_bag(self, environ, space, container_name):
        """
        Return True if the requested entity is part of the current
        space's recipe or an ADMIN BAG. Otherwise return False
        indicating that privileges will be dropped.
        """
        store = environ['tiddlyweb.store']
        recipe_name = determine_space_recipe(environ, space.name)
        space_recipe = store.get(Recipe(recipe_name))
        template = recipe_template(environ)
        recipe_bags = [bag for bag, _ in space_recipe.get_recipe(template)]
        recipe_bags.extend(space.extra_bags())
        if environ['REQUEST_METHOD'] == 'GET':
            if container_name in recipe_bags:
                return True
            if container_name in ADMIN_BAGS:
                return True
        else:
            base_bags = space.list_bags()
            # add bags in the recipe which may have been added
            # by the recipe mgt. That is: bags which are not
            # included and not core.
            acceptable_bags = [bag for bag in recipe_bags if not (
                Space.bag_is_public(bag) or Space.bag_is_private(bag)
                or Space.bag_is_associate(bag))]
            acceptable_bags.extend(base_bags)
            acceptable_bags.extend(ADMIN_BAGS)
            if container_name in acceptable_bags:
                return True

        return False
开发者ID:Alanchi,项目名称:tiddlyspace,代码行数:33,代码来源:controlview.py

示例5: _handle_dropping_privs

# 需要导入模块: from tiddlywebplugins.tiddlyspace.space import Space [as 别名]
# 或者: from tiddlywebplugins.tiddlyspace.space.Space import bag_is_public [as 别名]
    def _handle_dropping_privs(self, environ, req_uri):
        if environ['tiddlyweb.usersign']['name'] == 'GUEST':
            return

        http_host, _ = determine_host(environ)
        space_name = determine_space(environ, http_host)

        if space_name == None:
            return

        space = Space(space_name)

        store = environ['tiddlyweb.store']
        container_name = req_uri.split('/')[2]

        if req_uri.startswith('/bags/'):
            recipe_name = determine_space_recipe(environ, space_name)
            space_recipe = store.get(Recipe(recipe_name))
            template = recipe_template(environ)
            recipe_bags = [bag for bag, _ in space_recipe.get_recipe(template)]
            recipe_bags.extend(space.extra_bags())
            if environ['REQUEST_METHOD'] == 'GET':
                if container_name in recipe_bags:
                    return
                if container_name in ADMIN_BAGS:
                    return
            else:
                base_bags = space.list_bags()
                # add bags in the recipe which may have been added
                # by the recipe mgt. That is: bags which are not
                # included and not core.
                acceptable_bags = [bag for bag in recipe_bags if not (
                    Space.bag_is_public(bag) or Space.bag_is_private(bag)
                    or Space.bag_is_associate(bag))]
                acceptable_bags.extend(base_bags)
                acceptable_bags.extend(ADMIN_BAGS)
                if container_name in acceptable_bags:
                    return

        if (req_uri.startswith('/recipes/')
                and container_name in space.list_recipes()):
            return

        self._drop_privs(environ)
        return
开发者ID:Erls-Corporation,项目名称:tiddlyspace,代码行数:47,代码来源:controlview.py

示例6: make_space

# 需要导入模块: from tiddlywebplugins.tiddlyspace.space import Space [as 别名]
# 或者: from tiddlywebplugins.tiddlyspace.space.Space import bag_is_public [as 别名]
def make_space(space_name, store, member):
    """
    The details of creating the bags and recipes that make up a space.
    """
    space = Space(space_name)

    for bag_name in space.list_bags():
        bag = Bag(bag_name)
        bag.policy = _make_policy(member)
        if Space.bag_is_public(bag_name):
            bag.policy.read = []
        store.put(bag)

    info_tiddler = Tiddler('SiteInfo', space.public_bag())
    info_tiddler.text = 'Space %s' % space_name
    info_tiddler.modifier = store.environ.get('tiddlyweb.usersign',
            {}).get('name', 'GUEST')
    store.put(info_tiddler)

    # Duplicate GettingStarted into public bag.
    getting_started_tiddler = Tiddler(GETTING_STARTED_TIDDLER['title'],
            GETTING_STARTED_TIDDLER['bag'])
    try:
        getting_started_tiddler = store.get(getting_started_tiddler)
        getting_started_tiddler.bag = space.public_bag()
        store.put(getting_started_tiddler)
    except StoreError:
        pass

    public_recipe = Recipe(space.public_recipe())
    public_recipe.set_recipe(space.public_recipe_list())
    private_recipe = Recipe(space.private_recipe())
    private_recipe.set_recipe(space.private_recipe_list())
    private_recipe.policy = _make_policy(member)
    public_recipe.policy = _make_policy(member)
    public_recipe.policy.read = []
    store.put(public_recipe)
    store.put(private_recipe)
开发者ID:Alanchi,项目名称:tiddlyspace,代码行数:40,代码来源:spaces.py

示例7: space_bag

# 需要导入模块: from tiddlywebplugins.tiddlyspace.space import Space [as 别名]
# 或者: from tiddlywebplugins.tiddlyspace.space.Space import bag_is_public [as 别名]
def space_bag(bag_name):
    """
    Return true if the bag is a standard space bag. If it is
    there will be a space link.
    """
    return Space.bag_is_public(bag_name) or Space.bag_is_private(bag_name)
开发者ID:Alanchi,项目名称:tiddlyspace,代码行数:8,代码来源:htmlserialization.py

示例8: _space_bag

# 需要导入模块: from tiddlywebplugins.tiddlyspace.space import Space [as 别名]
# 或者: from tiddlywebplugins.tiddlyspace.space.Space import bag_is_public [as 别名]
 def _space_bag(self, bag_name):
     return Space.bag_is_public(bag_name) or Space.bag_is_private(bag_name)
开发者ID:EnoX1,项目名称:tiddlyspace,代码行数:4,代码来源:htmlserialization.py


注:本文中的tiddlywebplugins.tiddlyspace.space.Space.bag_is_public方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。