本文整理汇总了Python中tiddlywebplugins.tiddlyspace.space.Space.recipe_is_public方法的典型用法代码示例。如果您正苦于以下问题:Python Space.recipe_is_public方法的具体用法?Python Space.recipe_is_public怎么用?Python Space.recipe_is_public使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tiddlywebplugins.tiddlyspace.space.Space
的用法示例。
在下文中一共展示了Space.recipe_is_public方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: list_spaces
# 需要导入模块: from tiddlywebplugins.tiddlyspace.space import Space [as 别名]
# 或者: from tiddlywebplugins.tiddlyspace.space.Space import recipe_is_public [as 别名]
def list_spaces(environ, start_response):
"""
List all the spaces on the service, as a JSON list.
If a "mine" parameter is present, just get the current
user's spaces.
"""
store = environ['tiddlyweb.store']
mine = environ['tiddlyweb.query'].get('mine', [None])[0]
current_user = environ['tiddlyweb.usersign']['name']
if mine:
spaces = []
try:
recipe_names = store.storage.cached_storage.user_spaces(
current_user)
except AttributeError:
recipe_names = store.storage.user_spaces(current_user)
for recipe in recipe_names:
spaces.append(Space.name_from_recipe(recipe))
else:
spaces = [Space.name_from_recipe(recipe.name) for
recipe in store.list_recipes() if
Space.recipe_is_public(recipe.name)]
start_response('200 OK', [
('Cache-Control', 'no-cache'),
('Content-Type', 'application/json; charset=UTF-8')])
return simplejson.dumps([{'name': space, 'uri': space_uri(environ, space)}
for space in sorted(spaces)])
示例2: test_recipe_is
# 需要导入模块: from tiddlywebplugins.tiddlyspace.space import Space [as 别名]
# 或者: from tiddlywebplugins.tiddlyspace.space.Space import recipe_is_public [as 别名]
def test_recipe_is():
assert Space.recipe_is_public('cat_public')
assert not Space.recipe_is_public('cat_private')
assert Space.recipe_is_private('cat_private')
assert not Space.recipe_is_private('cat_public')