Пример #1
0
def wiki_new_page_like(wiki, page, author):
    np = wiki.new_page(wiki.get_unique_name(page))
    np.versions[-1].set_raw('<include %s latest>\n' % page.name)
    np.versions[-1].set_author(author)
    transaction_commit(None, 'NewLikeWikiPage')     # moved from wiki/wiki.ptl/WikiPageUI.newlike()   
    qon.search.searchengine.notify_new_wiki_page(np)
    return np
Пример #2
0
def wiki_edit_page(wiki, page, name, author, title, raw):
    name = _unicode_fix(name)
    title = _unicode_fix(title)
    raw = _unicode_fix(raw)
    
    if page is not None:
        # editing an existing page
        page.new_revision(author=author, title=title, raw=raw)
        author.notify_authored_item(page)        
        transaction_commit(None, 'EditWikiPage')    # moved from wiki/form.ptl/EditWikiPage.commit()
        qon.search.searchengine.notify_edited_wiki_page(page)
    else:
        # when trying to create a new page, ensure raw is not empty
        raw = raw or ' '
        page = wiki.new_page(name)
        page.versions[-1].set_raw(raw)
        page.versions[-1].set_title(title)
        page.versions[-1].set_author(author)
        author.notify_authored_item(page)               
        transaction_commit(None, 'EditWikiPage')    # moved from wiki/form.ptl/EditWikiPage.commit()       
        qon.search.searchengine.notify_new_wiki_page(page)
        
    return page