1. MoinAPI

Contents

  1. MoinAPI

PYTHONPATH を設定せよ。http://moinmo.in/MoinMoinQuestions/ConfigFiles

http://moinmo.in/MoinAPI/Beispiele#PageEditor in German

https://moinmo.in/MoinAPI/Examples#request /ScriptContext

3.4. PageEditor

The PageEditor class is used for all writing operations on a page of the wiki.
The access rights of the user are checked for operations that are carried out on wiki pages or their attachments.

Toggle line numbers

 1 from MoinMoin.PageEditor  import PageEditor

3.4.1. PageEditor.saveText ()

PageEditor.saveText () is used to save text on a page.
  In addition to the text that you want to save, 
  you also have to specify the revision of the page as a parameter.

Toggle line numbers

1 pagename = u ' TestPage ' 
2 text = u ' This is an example ' 
3 print  PageEditor ( request , pagename ). saveText ( text , 0 )

The confirmation for the successful saving is:

'Thank you for your changes. Your attention to detail is appreciated. '

This page is now on the wiki as you can easily check with a web browser. http: // localhost: 8080 / TestSeite

If you repeat the PageEditor (request, pagename) .saveText (text, 0) call without changing the text .

MoinMoin.PageEditor.Unchanged: You did not change the page content, not saved!

This error message should always be caught with a try ... except: block, see the following example:

Toggle line numbers

1 pagename = u ' TestPage ' 2 page = PageEditor ( request , pagename ) 3 text = u ' This is an example ' 4 try : 5 page . saveText ( text , 0 ) 6 except page . Unchanged : 7 print " You did not change the page content, not saved! " }}}

MoinQ: MoinAPI (last edited 2022-03-20 02:29:30 by ToshinoriMaeno)