We relaunched the TWiki.org project with an expanded TWiki charter, and we invite you to participate! The TWiki.org Code of Conduct agreement took effect on 27 Oct 2008. We ask existing twiki.org users to opt-in. You must opt-in to participate in the Blog, Codev, Plugins and TWiki webs. -- PeterThoeny - 27 Oct 2008
Tags:
create new tag
, view all tags

Question

Hi, I need to create / modify TWiki pages programatically. I can see the way they are made of just text files, so it seems easy to do the actual edit, but I would presume that it would be a good idea to have the page locked before the program tries to make changes. How would I do this please ? Execute a shell command to lock the page ?

Environment

TWiki version: TWikiRelease02Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: N/A
Web server: N/A
Perl version: N/A
Client OS: N/A
Web Browser: N/A
Categories: Add-Ons

-- CliveGalway - 23 Jun 2005

Answer

you may want to take a look at CPAN:WWW::Mechanize::TWiki which translates perl function calls into URIs which simulate a web browser. note that if you simply manually create the .txt files, this will break if/when there are alternate storage backends, eg, subversion or a database

-- WillNorris - 23 Jun 2005

Will is right, access over http is your safest bet.

As a hack, if you want to manipulate the files directly you could lock the files programmatically on the server. Assuming you want to lock Sandbox.FooBar, check/create/manipulate the data/Sandbox/FooBar.lock file. Example content:

PaulSmith
1122932341

The first line is the login user, the second line is the lock timestamp (Unix epoc time).

Note that this hack works just for the current production release. The lock algorithm changes in the DakarRelease.

-- PeterThoeny - 02 Aug 2005

 
Topic revision: r4 - 02 Aug 2005 - 11:40:42 - WillNorris
Support.ProgramaticallyGenerateTWikiPages moved from Support.ProgramaticallyGenerateTwikiPages on 02 Aug 2005 - 11:40 by WillNorris - put it back
 
TWIKI.NET
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback