Submitted by : coolestuk at: 2011-03-05T08:54:13-08:00 (3 years ago)
Name :
Category : Severity : Status :
Optional subject :  
Optional comment :

ZWiki 2.01b

Zope Version (Zope 2.11.8-final, python 2.4.6, linux2) Python Version 2.4.6 (#1, Feb 11 2011, 00:00:26) [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)]?

Using the following PUT_factory to enable docs to be added via WebDAV.

# simple put_factory from Products.ZWiki.ZWikiPage import ZWikiPage

def PUT_factory( self, name, typ, body ):
p=ZWikiPage('', __name__=name) p.setPageType('plaintext') return p

Files with a colon in the text do not register a problem on being added to the wiki via a webdav client (there is no error message on 'put'), but in the ZMI such files subsequently appear with a zero size, and when viewed via the ZWiki interface they are empty files.

When a file containing no colon is successfully loaded into the wiki via webdav, the text can be edited through the zwiki web interface and the colon added. After saving the changes, there is no problem with the file being displayed in the ZWiki interface, and in the ZMI the files shows up with a size.

workaround for adding page to wiki via WebDAV --coolestuk, Sun, 13 Mar 2011 05:23:13 -0700 reply

Before the pages are added to a ZWiki using WebDAV, preface the text of the pages with "Type: rstnn" or "Type: plaintextnn". The page then appears in the ZWiki. There then appears a subsequent problem.

When searching for the text that is in some of those pages now added to the wiki, the number of pages which are "hits" will be returned by searchwiki, indicating that the sought text is found in the page. In order to get (e.g.) an excerpt of the page containing the text to be returned from the search, I have to run /SomePage?/upgradeAll before the search functionality works properly.

I tried to add the "Type: plaintext" lines in the PUT_factory, but found that did not work (but then I'm not so clear about how what is returned by the PUT_factory then interfaces with the rest of the ZWiki insertion process). I run a external process on the text files before adding them via WebDAV which adds the required lines.

I think the right place for this workaround with inserting "Type: ..." should perhaps be in the PUT_factory. Perhaps that is also where the actions leading to the search working properly would also need to be placed (i.e. while the text of the page is added to the catalog, some other step is missing and only supplied by running /upgradeAll).

further details --coolestuk, Sat, 26 Mar 2011 05:01:16 -0700 reply

If the text file has a first line saying "Type: rst", and then the file contains something that would cause ZWiki to process the text as reST (e.g. the markup to indicate a Title), then not only can the documented by uploaded into the wiki, but it also appears to trigger the outline creation, such that when one searches for a term and it is found, the search results page does not just contain the names of pages containing the term, but also the summary text from the relevant pages is shown. Without triggering some identification of the text contents as reST, it seems as though there is a rendering problem (in such cases instead of summary text, all one sees is a list of lines saying "error".