Esempio n. 1
0
def createTables():
    """
    @return: None, create the right table at the first start, and initialized
    the node.
    """
    for model in [ Node, Context, Receiver, InternalTip, ReceiverTip, WhistleblowerTip,
                    Submission, Comment, File, PluginProfiles, ReceiverConfs ]:

        createdTable = yield tables.createTable(model)

    if not createdTable:
        return

    # Initialize the node
    store = config.main.zstorm.get('main_store')
    onlyNode = {}

    onlyNode['name'] = u"Please, set me: name/title"
    onlyNode['description'] = u"Please, set me: description"
    onlyNode['hidden_service'] = u"Please, set me: hidden service"
    onlyNode['public_site'] = u"Please, set me: public site"
    onlyNode['email'] = u"*****@*****.**"
    onlyNode['stats_update_time'] = 2 # hours
    onlyNode['languages'] = [ { "code" : "it" , "name": "Italiano"}, { "code" : "en" , "name" : "English" }]

    node_created = Node(store).new(onlyNode)

    # new is the only Models function executed without @transact, call .add, but
    # the called has to .commit and .close, operations commonly performed by decorator
    store.commit()
    store.close()
Esempio n. 2
0
def createTables():
    """
    @return: None, create the right table at the first start, and initialized
    the node.
    """
    for model in [ Node, Context, Receiver, InternalTip, ReceiverTip, WhistleblowerTip,
                    Submission, Comment, File, PluginProfiles, ReceiverConfs ]:

        yield tables.createTable(model)