Esempio n. 1
0
def simple_text_entry(db, user_oid, title, body):
    """
    Simple creation of text entry with only one revision, using title string and body string.
    
    """
    
    
    t = dm.text_entry_revision_create(title, body)
    
    t.update(dm.revision_create(user_oid))
    
    toid = db.revisions.insert(t)
    t['_id'] = toid
            
    e = dm.entry_create(toid, t['class'], t)
    
    eoid = db.entries.insert(e)
    return eoid
Esempio n. 2
0
def simple_page_create(db, systemdbname,
                       user_oid, title, entry_oid_list, tags=None):
    """
    Create a page with the list of entries, all visible, unpinned
    """

    entries = [{'entry' : bson.dbref.DBRef("entries", e),
                'hidden' : False} for e in entry_oid_list]

    p = dm.page_entry_revision_create(title, entries)
    
    p.update(dm.revision_create(user_oid, systemdbname, tags=tags))

    poid = db.revisions.insert(p)
    p["_id"] = poid

    e = dm.entry_create(poid, p['class'], p)
    eoid = db.entries.insert(e)
    
    return eoid