Пример #1
0
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)
Пример #2
0
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)
Пример #3
0
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)
Пример #4
0
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)

    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)
Пример #5
0
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)
Пример #6
0
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)