Exemplo n.º 1
0
def db(realm):
    """
    Creates default pages/articles in blx.pages

    @param  string  realm   realm that will own pages
    """
    print 'Creating default pages'
    try:
        JBObject.setRealm(realm)
    except JBError:
        pass
    db = JBDB.instance()
    cur = db.cursor()
    query = 'select blx.set_page(%s, %s, %s, %s, %s)'
    params = [('index.html', realm, u'Strona główna', 108, u'[news]'),\
        ('_special.html', realm, u'Strony specjalne', 108, \
            u'<ul><li><a href="/_special/menu.html">Menu (PL)</li></ul>'),
        ('_special/menu.html', realm, u'Menu (PL)', 108, \
            u'<ul><li>Forum</li><li>O stronie</li></ul>')]
    cur.executemany(query, params)
    db.connect().commit()
Exemplo n.º 2
0
def mine(id, name, path, group):
    """
    Creates public chamber with given id, name and path for given group.

    @param  string  id      chamber ID
    @param  string  name    chamber name
    @param  string  path    path inside /home/jaskinia/realms/pliki -without it!
    @param  int     group   group that will manage new chamber
    """
    print 'Creating mine chamber'
    try:
        JBObject.setRealm('kopalnia')
    except JBError:
        abort('Couldn`t set realm')

    db = JBDB.instance()
    cur = db.cursor()
    query='insert into chambers values (%s, %s, %s, %s::int[], %s::int[], ' \
        + '%s::int[], %s::int[], %s::int[], %s::int[], %s)'
    params = (id, name, path, None, [group], [group], \
        None, None, None, False)
    cur.execute(query, params)
    db.connect().commit()