[Zope3-checkins] CVS: Zope3/src/zope/app/wiki - CHANGES.txt:1.1
README.txt:1.2 TODO.txt:1.2 VERSION.txt:1.2
configure.zcml:1.3 interfaces.py:1.2 wikipage.py:1.2 index.py:NONE
Stephan Richter
srichter at cosmos.phy.tufts.edu
Tue Mar 2 09:25:33 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/wiki
In directory cvs.zope.org:/tmp/cvs-serv21798/src/zope/app/wiki
Modified Files:
README.txt TODO.txt VERSION.txt configure.zcml interfaces.py
wikipage.py
Added Files:
CHANGES.txt
Removed Files:
index.py
Log Message:
Updated Wiki product to follow new API and design patterns. See CHANGES.txt
for detailed information.
=== Added File Zope3/src/zope/app/wiki/CHANGES.txt ===
CHANGES
Version 0.1.0
- Since Indices and ObjectHub are not part of Zope X3.0, I removed the
index-based search and replaced it by a very primitive one.
- Removed old disgusting comment support, and made the wiki page a
container which can contain comments.
- Fixed browser views according to the new implementations.
Version 0.0.1
- Initial version of Zope3 Wiki
=== Zope3/src/zope/app/wiki/README.txt 1.1 => 1.2 ===
--- Zope3/src/zope/app/wiki/README.txt:1.1 Fri Feb 27 06:06:58 2004
+++ Zope3/src/zope/app/wiki/README.txt Tue Mar 2 09:25:00 2004
@@ -12,6 +12,8 @@
- Plain Text
+ - Structured Text
+
- reStructured Text (reST)
=== Zope3/src/zope/app/wiki/TODO.txt 1.1 => 1.2 ===
--- Zope3/src/zope/app/wiki/TODO.txt:1.1 Fri Feb 27 06:06:58 2004
+++ Zope3/src/zope/app/wiki/TODO.txt Tue Mar 2 09:25:00 2004
@@ -5,6 +5,12 @@
- Write tests for diff module
+ - Write tests for Comment title
+
+ - Convert unit tests to doc tests
+
+ - Add functional tests
+
Rendering/Views
@@ -29,3 +35,5 @@
- Activating diff support for edited Wiki Pages. The main issue right now
is to get to the old version of the text. so that we can execute the
Differ.
+
+ - Update POT and translations
\ No newline at end of file
=== Zope3/src/zope/app/wiki/VERSION.txt 1.1 => 1.2 ===
--- Zope3/src/zope/app/wiki/VERSION.txt:1.1 Fri Feb 27 06:06:58 2004
+++ Zope3/src/zope/app/wiki/VERSION.txt Tue Mar 2 09:25:00 2004
@@ -1 +1 @@
-Zope3 Wiki 0.0.1
\ No newline at end of file
+Zope3 Wiki 0.1.0
\ No newline at end of file
=== Zope3/src/zope/app/wiki/configure.zcml 1.2 => 1.3 ===
--- Zope3/src/zope/app/wiki/configure.zcml:1.2 Fri Feb 27 06:48:29 2004
+++ Zope3/src/zope/app/wiki/configure.zcml Tue Mar 2 09:25:00 2004
@@ -78,6 +78,11 @@
<!-- Content declarations -->
+ <interface
+ interface=".interfaces.IWiki"
+ type="zope.app.interfaces.content.IContentType"
+ />
+
<content class=".wiki.Wiki">
<implements interface="zope.app.interfaces.container.IContentContainer" />
@@ -86,7 +91,7 @@
interface="zope.app.interfaces.annotation.IAttributeAnnotatable" />
<factory
- id="Wiki"
+ id="zope.wiki.Wiki"
permission="zope.ManageContent"
description="Minimal Wiki Page Container implementation " />
@@ -107,19 +112,24 @@
for=".interfaces.IWiki" />
+ <!-- Wiki Page Content Type -->
+
+ <interface
+ interface=".interfaces.IWikiPage"
+ type="zope.app.interfaces.content.IContentType"
+ />
+
<content class=".wikipage.WikiPage">
<implements
interface="zope.app.interfaces.annotation.IAttributeAnnotatable" />
<factory
- id="WikiPage"
+ id="zope.wiki.WikiPage"
permission="zope.app.wiki.AddWikiPage"
title="Wiki Page"
description="A Wiki Page" />
- <!-- XXX: I am not sure whether this is safe. We probably have to split
- the interface from the schema. -->
<allow interface=".interfaces.IWikiPage" />
<require
@@ -133,6 +143,33 @@
provides=".interfaces.IWikiPageHierarchy"
for=".interfaces.IWikiPage" />
+ <!-- Wiki Comments support -->
+
+ <interface
+ interface=".interfaces.IComment"
+ type="zope.app.interfaces.content.IContentType"
+ />
+
+ <content class=".wikipage.Comment">
+
+ <implements
+ interface="zope.app.interfaces.annotation.IAttributeAnnotatable" />
+
+ <factory
+ id="zope.wiki.Comment"
+ permission="zope.app.wiki.CommentWikiPage"
+ title="Wiki Page Comment"
+ description="A Wiki Page Comment" />
+
+ <allow interface=".interfaces.IComment" />
+
+ <require
+ permission="zope.app.wiki.CommentWikiPage"
+ set_schema=".interfaces.IComment" />
+
+ </content>
+
+
<!-- Mail Subscriptions support -->
<adapter
factory=".wikipage.MailSubscriptions"
@@ -145,12 +182,6 @@
for=".interfaces.IWikiPage" />
- <adapter
- factory="zope.app.wiki.wikipage.SearchableText"
- provides="zope.app.interfaces.index.text.ISearchableText"
- for="zope.app.wiki.interfaces.IWikiPage" />
-
-
<!-- WikiPage FTP configurations -->
<adapter
for=".interfaces.IWikiPage"
@@ -165,26 +196,6 @@
factory=".wikipage.WikiPageWriteFile"
permission="zope.app.wiki.EditWikiPage"
/>
-
- <!-- Wiki Index registration -->
-
- <content class=".index.WikiTextIndex">
-
- <require
- permission="zope.ManageServices"
- interface="zope.app.interfaces.index.text.IUITextIndex"
- attributes="query"
- />
-
- <factory
- id="zope.app.wiki.index.WikiTextIndex"
- permission="zope.ManageServices"
- />
- <implements
- interface="zope.app.interfaces.services.query.IQueryProcessable"
- />
-
- </content>
<!-- Register event listener for change mails -->
<event:subscribe
=== Zope3/src/zope/app/wiki/interfaces.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/wiki/interfaces.py:1.1 Fri Feb 27 06:06:58 2004
+++ Zope3/src/zope/app/wiki/interfaces.py Tue Mar 2 09:25:00 2004
@@ -21,43 +21,73 @@
from zope.schema import TextLine, List, SourceText
from zope.schema.vocabulary import VocabularyField
-#from zope.app.interfaces.container import IContentContainer
from zope.schema import Field
from zope.app.interfaces.container import IContained
from zope.app.container.constraints import ContainerTypesConstraint
from zope.app.container.constraints import ItemTypePrecondition
-from zope.app.interfaces.container import IContainer
+from zope.app.interfaces.container import IContainer, IContentContainer
from zope.app.i18n import ZopeMessageIDFactory as _
-class IWikiPage(Interface):
- """A single Wiki Page content object.
+class IComment(Interface):
+ """A simple Wiki Page comment.
- The Wiki page is a simple content object that stores the content
- (source) and the source type of the wiki page."""
+ This interface specifies only the actual comment. Meta-data will be
+ managed via annotations and the Dublin Core as usual.
+ """
+
+ title = TextLine(
+ title=_(u"Title"),
+ description=_(u"Comment Title"),
+ default=u"",
+ required=True)
source = SourceText(
title=_(u"Source Text"),
- description=_(u"Renderable source text of the Wiki Page."),
+ description=_(u"Renderable source text of the comment."),
default=u"",
required=True)
type = VocabularyField(
title=_(u"Source Type"),
description=_(u"Type of the source text, e.g. structured text"),
- default=u"reStructured Text (reST)",
+ default=u"zope.source.rest",
required = True,
vocabulary = "SourceTypes")
- def append(source):
- """Append some text to the existing source text."""
- def comment(source, user):
- """Comment on the current Wiki; add comment to source."""
+class IWikiPage(IContainer, IContentContainer):
+ """A single Wiki Page content object.
+
+ The Wiki page is a simple content object that stores the content
+ (source) and the source type of the wiki page.
+ """
+
+ def __setitem__(name, object):
+ """Add a comment object."""
+
+ __setitem__.precondition = ItemTypePrecondition(IComment)
+
+ source = SourceText(
+ title=_(u"Source Text"),
+ description=_(u"Renderable source text of the Wiki Page."),
+ default=u"",
+ required=True)
- def getCommentCounter():
- """Returns the amount of written comments for this wiki page."""
+ type = VocabularyField(
+ title=_(u"Source Type"),
+ description=_(u"Type of the source text, e.g. structured text"),
+ default=u"zope.source.rest",
+ required = True,
+ vocabulary = "SourceTypes")
+class IWikiPageContained(IContained):
+ """Objects that can be contained by Wiki Pages should implement this
+ interface."""
+ __parent__ = Field(
+ constraint = ContainerTypesConstraint(IWikiPage))
+
+
class IWikiPageHierarchy(Interface):
"""This interface supports the virtual hierarchical structure of the Wiki
Pages."""
@@ -97,15 +127,18 @@
"""
class IWiki(IContainer):
+ """A simple container that manages Wikis inside itself."""
+
def __setitem__(name, object):
- """Add a poll"""
+ """Add a wiki page object."""
+
__setitem__.precondition = ItemTypePrecondition(IWikiPage)
class IWikiContained(IContained):
+ """Objects that contain Wikis should implement this interface."""
__parent__ = Field(
constraint = ContainerTypesConstraint(IWiki))
-
class IMailSubscriptions(Interface):
=== Zope3/src/zope/app/wiki/wikipage.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/wiki/wikipage.py:1.1 Fri Feb 27 06:06:58 2004
+++ Zope3/src/zope/app/wiki/wikipage.py Tue Mar 2 09:25:00 2004
@@ -19,17 +19,18 @@
from persistent import Persistent
from zope.interface import implements
-from zope.component import getAdapter
-from zope.app.traversing import getParent, getName
-from zope.app.interfaces.index.text import ISearchableText
+from zope.app import zapi
+from zope.app.container.btree import BTreeContainer
+from zope.app.dublincore.interfaces import ICMFDublinCore
from zope.app.interfaces.file import IReadFile, IWriteFile
from zope.app.interfaces.annotation import IAnnotations
from zope.app.interfaces.event import ISubscriber
from zope.app.interfaces.event import IObjectAddedEvent, IObjectModifiedEvent
from zope.app.interfaces.event import IObjectRemovedEvent, IObjectMovedEvent
-from zope.app.wiki.interfaces import IWiki, IWikiPage
+from zope.app.wiki.interfaces import IWiki, IWikiPage, IComment
+from zope.app.wiki.interfaces import IWikiContained, IWikiPageContained
from zope.app.wiki.interfaces import IWikiPageHierarchy, IMailSubscriptions
__metaclass__ = type
@@ -38,33 +39,20 @@
SubscriberKey = 'http://www.zope.org/zwiki#1.0/MailSubscriptions/emails'
-class WikiPage(Persistent):
- __doc__ = IWikiPage.__doc__
+class WikiPage(BTreeContainer):
+ """A persistent Wiki Page implementation."""
- implements(IWikiPage)
+ implements(IWikiPage, IWikiContained)
+
+ # See zope.app.interfaces.container.IContained
+ __parent__ = __name__ = None
# See zope.app.wiki.interfaces.IWikiPage
source = u''
# See zope.app.wiki.interfaces.IWikiPage
- type = u'reStructured Text (reST)'
-
- def __init__(self):
- self.__comments = 1
+ type = u'zope.source.rest'
- def append(self, source):
- "See zope.app.wiki.interfaces.IWikiPage"
- self.source += source
-
- def comment(self, comment):
- "See zope.app.wiki.interfaces.IWikiPage"
- self.__comments += 1
- self.append(comment)
-
- def getCommentCounter(self):
- "See zope.app.wiki.interfaces.IWikiPage"
- return self.__comments
-
class WikiPageHierarchyAdapter:
__doc__ = IWikiPageHierarchy.__doc__
@@ -74,7 +62,7 @@
def __init__(self, context):
self.context = context
- self._annotations = getAdapter(context, IAnnotations)
+ self._annotations = zapi.getAdapter(context, IAnnotations)
if not self._annotations.get(HierarchyKey):
self._annotations[HierarchyKey] = ()
@@ -95,18 +83,18 @@
# XXX: Allow for multpile parents
if not self.getParents():
return [self.context]
- wiki = getParent(self.context)
+ wiki = zapi.getParent(self.context)
name = self.getParents()[0]
- hier = getAdapter(wiki[name], IWikiPageHierarchy)
+ hier = zapi.getAdapter(wiki[name], IWikiPageHierarchy)
return hier.path() + [self.context]
def findChildren(self, recursive=True):
"See zope.app.wiki.interfaces.IWikiPageHierarchy"
- wiki = getParent(self.context)
- contextName = getName(self.context)
+ wiki = zapi.getParent(self.context)
+ contextName = zapi.name(self.context)
children = []
for pageName in wiki:
- hier = getAdapter(wiki[pageName], IWikiPageHierarchy)
+ hier = zapi.getAdapter(wiki[pageName], IWikiPageHierarchy)
if contextName in hier.getParents():
if recursive:
subs = hier.findChildren()
@@ -116,6 +104,34 @@
return tuple(children)
+# Simple comments implementation
+
+class Comment(Persistent):
+ """A simple persistent comment implementation."""
+ implements(IComment, IWikiPageContained)
+
+ # See zope.app.interfaces.container.IContained
+ __parent__ = __name__ = None
+
+ # See zope.app.wiki.interfaces.IComment
+ source = u''
+
+ # See zope.app.wiki.interfaces.IComment
+ type = u'zope.source.rest'
+
+
+ # See zope.app.wiki.interfaces.IComment
+ def _getTitle(self):
+ dc = zapi.getAdapter(self, ICMFDublinCore)
+ return dc.title
+
+ def _setTitle(self, title):
+ dc = zapi.getAdapter(self, ICMFDublinCore)
+ dc.title = title
+
+ title = property(_getTitle, _setTitle)
+
+
# Adapters for file-system style access
class WikiPageReadFile:
@@ -150,22 +166,6 @@
self.context.source = unicode(data)
-# Adapter for ISearchableText
-
-class SearchableText:
- """This adapter provides an API that allows the Wiki Pages to be indexed
- by the Text Index."""
-
- implements(ISearchableText)
- __used_for__ = IWikiPage
-
- def __init__(self, page):
- self.page = page
-
- def getSearchableText(self):
- return [unicode(self.page.source)]
-
-
# Component to fullfill mail subscriptions
class MailSubscriptions:
@@ -177,7 +177,7 @@
def __init__(self, context):
self.context = context
- self._annotations = getAdapter(context, IAnnotations)
+ self._annotations = zapi.getAdapter(context, IAnnotations)
if not self._annotations.get(SubscriberKey):
self._annotations[SubscriberKey] = ()
@@ -227,7 +227,7 @@
self.handleRemoved(event.object)
def handleAdded(self, object):
- subject = 'Added: '+getName(object)
+ subject = 'Added: '+zapi.name(object)
emails = self.getAllSubscribers(object)
body = object.source
self.mail(emails, subject, body)
@@ -235,13 +235,13 @@
def handleModified(self, object):
# XXX: Should have some nice diff code here.
# from diff import textdiff
- subject = 'Modified: '+getName(object)
+ subject = 'Modified: '+zapi.name(object)
emails = self.getAllSubscribers(object)
body = object.source
self.mail(emails, subject, body)
def handleRemoved(self, object):
- subject = 'Removed: '+getName(object)
+ subject = 'Removed: '+zapi.name(object)
emails = self.getAllSubscribers(object)
body = subject
self.mail(emails, subject, body)
@@ -249,9 +249,9 @@
def getAllSubscribers(self, object):
"""Retrieves all email subscribers by looking into the local Wiki Page
and into the Wiki for the global subscriptions."""
- emails = tuple(getAdapter(object,
+ emails = tuple(zapi.getAdapter(object,
IMailSubscriptions).getSubscriptions())
- emails += tuple(getAdapter(getParent(object),
+ emails += tuple(zapi.getAdapter(zapi.getParent(object),
IMailSubscriptions).getSubscriptions())
return emails
=== Removed File Zope3/src/zope/app/wiki/index.py ===
More information about the Zope3-Checkins
mailing list