[Zope3-checkins] CVS: zopeproducts/zwiki - TODO.txt:1.6 browser.py:1.6 configure.zcml:1.9 interfaces.py:1.4 zwiki.py:1.10 plaintext.py:NONE stx.py:NONE

Stephan Richter srichter@cbu.edu
Tue, 8 Apr 2003 22:49:39 -0400


Update of /cvs-repository/zopeproducts/zwiki
In directory cvs.zope.org:/tmp/cvs-serv9806

Modified Files:
	TODO.txt browser.py configure.zcml interfaces.py zwiki.py 
Removed Files:
	plaintext.py stx.py 
Log Message:
- Moved renderers to own sub-module. 

- Implemented comments via renderers

- Updated to latest version of StructuredText (now Zope 2 HEAD version)


=== zopeproducts/zwiki/TODO.txt 1.5 => 1.6 ===
--- zopeproducts/zwiki/TODO.txt:1.5	Tue Apr  8 01:21:15 2003
+++ zopeproducts/zwiki/TODO.txt	Tue Apr  8 22:49:08 2003
@@ -7,8 +7,6 @@
 
     - Add test for findChildren.
 
-    - Add tests for metaconfigure.py
-
     - Add tests for plain text and STX formatter.
 
     - Add tests for Traverser (I have no clue how to do that).    
@@ -20,6 +18,8 @@
     - Create a custom skin, so that we are not relying on the standard Zope 3
       skin.
 
+    - Create custom HTMLDocument class for rendering the STX in Wiki style.
+
     - Make sure FTP and WebDAV work.
 
     - Have a "Jump to" form on the WikiPage view.
@@ -54,3 +54,5 @@
     - Implements E-mail subscriptions.
 
     - Use Renderer classes to implement comment generator.
+
+    - Internationalize the product.
\ No newline at end of file


=== zopeproducts/zwiki/browser.py 1.5 => 1.6 ===
--- zopeproducts/zwiki/browser.py:1.5	Tue Apr  8 00:15:02 2003
+++ zopeproducts/zwiki/browser.py	Tue Apr  8 22:49:08 2003
@@ -135,7 +135,7 @@
         source = types.createObject(self.context.type,
                                     self.context.source)
         view = getView(source, None, self.request)
-        html = view.render(self.context, self.request)
+        html = view.render(self.context)
         html = self.renderWikiLinks(html)
         return html
 
@@ -235,8 +235,8 @@
             m = re.search(remotewikiurl, str(localpage))
             if m is not None:
                 # NB: pages are stored html-quoted XXX eh ? they are ?
-                # something's not right somewhere..  I have lost my grip on this
-                # whole quoting issue.
+                # something's not right somewhere..  I have lost my grip on
+                # this whole quoting issue.
                 remoteurl = html_unquote(m.group(1))
 
                 # we have a valid inter-wiki link
@@ -283,7 +283,11 @@
 class WikiPageComment:
 
     def comment(self, comment):
-        self.context.comment(comment, self.request.user.getLogin())
+        types = getService(self.context, "WikiSourceTypeRegistry")
+        source = types.createObject(self.context.type, self.context.source)
+        view = getView(source, None, self.request)
+        comment = view.createComment(comment, self.context.getCommentCounter())
+        self.context.comment(comment)
         return self.request.response.redirect('.')
 
 


=== zopeproducts/zwiki/configure.zcml 1.8 => 1.9 ===
--- zopeproducts/zwiki/configure.zcml:1.8	Tue Apr  8 01:21:15 2003
+++ zopeproducts/zwiki/configure.zcml	Tue Apr  8 22:49:08 2003
@@ -174,22 +174,6 @@
     component=".sourcetype.SourceTypes" />
 
 <include file="meta.zcml" />
-
-<wiki:sourcetype
-    title="Plain Text" 
-    interface=".interfaces.IPlainTextSource">
-  <wiki:renderer 
-      for="zope.publisher.interfaces.browser.IBrowserPresentation" 
-      factory=".plaintext.PlainTextToHTMLRenderer" />
-</wiki:sourcetype>
-
-<wiki:sourcetype 
-    title="Structured Text" 
-    interface=".interfaces.IStructuredTextSource">
-  <wiki:renderer 
-      for="zope.publisher.interfaces.browser.IBrowserPresentation" 
-      factory=".stx.StructuredTextToHTMLRenderer" />
-</wiki:sourcetype>
-
+<include package=".renderer" />
 
 </zopeConfigure>


=== zopeproducts/zwiki/interfaces.py 1.3 => 1.4 ===
--- zopeproducts/zwiki/interfaces.py:1.3	Tue Apr  8 00:15:02 2003
+++ zopeproducts/zwiki/interfaces.py	Tue Apr  8 22:49:08 2003
@@ -54,6 +54,9 @@
     def comment(source, user):
         """Comment on the current Wiki; add comment to source."""
 
+    def getCommentCounter():
+        """Returns the amount of written comments for this wiki page."""
+        
 
 class IWikiPageHierarchy(Interface):
     """This interface supports the virtual hierarchical structure of the Wiki


=== zopeproducts/zwiki/zwiki.py 1.9 => 1.10 ===
--- zopeproducts/zwiki/zwiki.py:1.9	Tue Apr  8 01:21:15 2003
+++ zopeproducts/zwiki/zwiki.py	Tue Apr  8 22:49:08 2003
@@ -15,6 +15,8 @@
 
 $Id$
 """
+from persistence import Persistent
+
 from zope.component import getAdapter, getService
 from zope.proxy.context import ContextWrapper
 from zope.app.content.folder import Folder
@@ -33,7 +35,7 @@
     __implements__ = (IWiki, Folder.__implements__)
 
 
-class WikiPage:
+class WikiPage(Persistent):
     __doc__ = IWikiPage.__doc__
 
     __implements__ = IWikiPage
@@ -44,20 +46,23 @@
     # See zopeproducts.zwiki.interfaces.IWikiPage
     type = u'Plain Text'
 
-    __comments = 0
+
+    def __init__(self):
+        self.__comments = 1
 
     def append(self, source):
         "See zopeproducts.zwiki.interfaces.IWikiPage"
         self.source += source
 
-    def comment(self, source, user):
+    def comment(self, comment):
         "See zopeproducts.zwiki.interfaces.IWikiPage"
-        # XXX: KISS for now.
         self.__comments += 1
-        if self.__comments == 1:
-            self.append('\n\n' + '-'*20);
-        self.append(comment_template %(self.__comments, user, source))
+        self.append(comment)
 
+    def getCommentCounter(self):
+        "See zopeproducts.zwiki.interfaces.IWikiPage"
+        return self.__comments
+        
 
 class WikiPageHierarchyAdapter:
     __doc__ = IWikiPageHierarchy.__doc__
@@ -103,8 +108,7 @@
         contextName = objectName(self.context)
         children = []
         for pageName in wiki:
-            wrapped = ContextWrapper(wiki[pageName], wiki,
-                                     name=pageName)
+            wrapped = ContextWrapper(wiki[pageName], wiki, name=pageName)
             hier = getAdapter(wrapped, IWikiPageHierarchy)
             if contextName in hier.getParents():
                 if recursive:
@@ -113,10 +117,4 @@
                     subs = ()
                 children.append((wrapped, subs))
         return children
-
-
-comment_template = '''
-
-Comment #%i by %s
-%s'''
 

=== Removed File zopeproducts/zwiki/plaintext.py ===

=== Removed File zopeproducts/zwiki/stx.py ===