[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/wiki/ Removed all
wiki XXX, fixing them, removing them or converting them to
Stephan Richter
srichter at cosmos.phy.tufts.edu
Thu Jul 8 15:50:17 EDT 2004
Log message for revision 26228:
Removed all wiki XXX, fixing them, removing them or converting them to
TODO items.
-=-
Modified: Zope3/trunk/src/zope/app/wiki/TODO.txt
===================================================================
--- Zope3/trunk/src/zope/app/wiki/TODO.txt 2004-07-08 19:47:55 UTC (rev 26227)
+++ Zope3/trunk/src/zope/app/wiki/TODO.txt 2004-07-08 19:50:17 UTC (rev 26228)
@@ -37,3 +37,8 @@
Differ.
- Update POT and translations
+
+ - Allow for multiple parents. The WikiPageHierarchyAdapter.path() method
+ only returns the path of a wiki and not all the possible paths it has.
+
+ - Make use of indices in search, once they are back in the core again.
\ No newline at end of file
Modified: Zope3/trunk/src/zope/app/wiki/browser/wiki.py
===================================================================
--- Zope3/trunk/src/zope/app/wiki/browser/wiki.py 2004-07-08 19:47:55 UTC (rev 26227)
+++ Zope3/trunk/src/zope/app/wiki/browser/wiki.py 2004-07-08 19:50:17 UTC (rev 26228)
@@ -49,7 +49,7 @@
"""Search Wiki Pages"""
def query(self):
- # XXX: Should use indices once they are back in Zope 3
+ # Should use indices once they are back in Zope 3
queryText = self.request.get('queryText', '')
results = []
for name, page in self.context.items():
Modified: Zope3/trunk/src/zope/app/wiki/browser/wikipage.py
===================================================================
--- Zope3/trunk/src/zope/app/wiki/browser/wikipage.py 2004-07-08 19:47:55 UTC (rev 26227)
+++ Zope3/trunk/src/zope/app/wiki/browser/wikipage.py 2004-07-08 19:50:17 UTC (rev 26228)
@@ -242,9 +242,6 @@
# local page found - search for "RemoteWikiUrl: url"
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.
remoteurl = html_unquote(m.group(1))
# we have a valid inter-wiki link
Modified: Zope3/trunk/src/zope/app/wiki/comment.py
===================================================================
--- Zope3/trunk/src/zope/app/wiki/comment.py 2004-07-08 19:47:55 UTC (rev 26227)
+++ Zope3/trunk/src/zope/app/wiki/comment.py 2004-07-08 19:50:17 UTC (rev 26228)
@@ -19,6 +19,7 @@
from zope.interface import implements
from zope.schema.vocabulary import getVocabularyRegistry
+from zope.app.container.contained import Contained
from zope.app.dublincore.interfaces import ICMFDublinCore
from zope.app.filerepresentation.interfaces import IReadFile, IWriteFile
@@ -26,7 +27,7 @@
from zope.app.wiki.interfaces import IWikiPageContained
-class Comment(Persistent):
+class Comment(Persistent, Contained):
r"""A simple persistent comment implementation.
The comment is really a primitive object, since it only declares a couple
@@ -65,9 +66,6 @@
"""
implements(IComment, IWikiPageContained)
- # See zope.app.container.interfaces.IContained
- __parent__ = __name__ = None
-
# See zope.app.wiki.interfaces.IComment
source = u''
Modified: Zope3/trunk/src/zope/app/wiki/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/wiki/interfaces.py 2004-07-08 19:47:55 UTC (rev 26227)
+++ Zope3/trunk/src/zope/app/wiki/interfaces.py 2004-07-08 19:50:17 UTC (rev 26228)
@@ -111,10 +111,6 @@
The return value for this method should be a list of wiki objects
describing the path.
-
- XXX: Wiki Pages can have several parents, so that we should be able to
- have multiple paths; but let's not worry about that right now. At some
- point this needs to be done though.
"""
def findChildren(recursive=True):
Modified: Zope3/trunk/src/zope/app/wiki/tests/test_traverser.py
===================================================================
--- Zope3/trunk/src/zope/app/wiki/tests/test_traverser.py 2004-07-08 19:47:55 UTC (rev 26227)
+++ Zope3/trunk/src/zope/app/wiki/tests/test_traverser.py 2004-07-08 19:50:17 UTC (rev 26228)
@@ -11,23 +11,28 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""
+"""Test wiki page traverser
$Id$
"""
+import unittest, sys
-import unittest, sys
from zope.component.tests.request import Request
-from zope.component import getService
-from zope.app.servicenames import Presentation
-from zope.interface import Interface
+from zope.interface import Interface, classImplements
from zope.exceptions import NotFoundError
-from zope.app.tests.placelesssetup import PlacelessSetup
from zope.proxy import removeAllProxies
-from zope.app.wiki.interfaces import IWikiPage
+from zope.app import zapi
+from zope.app.annotation.attribute import AttributeAnnotations
+from zope.app.annotation.interfaces import IAnnotations, IAttributeAnnotatable
+from zope.app.location.interfaces import ILocation
+from zope.app.location.traversing import LocationPhysicallyLocatable
+from zope.app.tests import ztapi
+from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.traversing.interfaces import IPhysicallyLocatable
+from zope.app.wiki.interfaces import IWikiPage, IWikiPageHierarchy
from zope.app.wiki.wiki import Wiki
-from zope.app.wiki.wikipage import WikiPage
+from zope.app.wiki.wikipage import WikiPage, WikiPageHierarchyAdapter
from zope.app.wiki.traversal import WikiPageTraverser
class I(Interface):
@@ -43,15 +48,23 @@
class TestTraverser(PlacelessSetup, unittest.TestCase):
+ def setUp(self):
+ super(TestTraverser, self).setUp()
+ classImplements(WikiPage, IAttributeAnnotatable)
+ ztapi.provideAdapter(IWikiPage, IWikiPageHierarchy,
+ WikiPageHierarchyAdapter)
+ ztapi.provideAdapter(IAttributeAnnotatable, IAnnotations,
+ AttributeAnnotations)
+ ztapi.provideAdapter(ILocation, IPhysicallyLocatable,
+ LocationPhysicallyLocatable)
+
def testAttr(self):
wiki = Wiki()
page1 = WikiPage()
+ wiki['FrontPage'] = page1
page2 = WikiPage()
- wiki['FrontPage'] = page1
wiki['FooBar'] = page2
- # get the items again so they'll be wrapped in ContainedProxy
- page1 = wiki['FrontPage']
- page2 = wiki['FooBar']
+ IWikiPageHierarchy(page2).parents = ('FrontPage',)
request = Request(I, '')
T = WikiPageTraverser(page1, request)
@@ -63,16 +76,15 @@
def testView(self):
wiki = Wiki()
page1 = WikiPage()
+ wiki['FrontPage'] = page1
page2 = WikiPage()
- wiki['FrontPage'] = page1
wiki['FooBar'] = page2
- # get the items again so they'll be wrapped in ContainedProxy
- page1 = wiki['FrontPage']
- page2 = wiki['FooBar']
+ IWikiPageHierarchy(page2).parents = ('FrontPage',)
request = Request(I, '')
T = WikiPageTraverser(page1, request)
- getService(Presentation).provideView(IWikiPage, 'viewfoo', I, View)
+ zapi.getService(zapi.servicenames.Presentation).provideView(
+ IWikiPage, 'viewfoo', I, View)
self.failUnless(
T.publishTraverse(request, 'viewfoo').__class__ is View )
Modified: Zope3/trunk/src/zope/app/wiki/traversal.py
===================================================================
--- Zope3/trunk/src/zope/app/wiki/traversal.py 2004-07-08 19:47:55 UTC (rev 26227)
+++ Zope3/trunk/src/zope/app/wiki/traversal.py 2004-07-08 19:50:17 UTC (rev 26228)
@@ -19,10 +19,11 @@
from zope.publisher.interfaces import IPublishTraverse
from zope.exceptions import NotFoundError
+from zope.app import zapi
from zope.app.traversing.api import getParent
from zope.app.traversing.namespace import UnexpectedParameters
from zope.app.traversing.interfaces import ITraversable
-from zope.app.wiki.interfaces import IWikiPage
+from zope.app.wiki.interfaces import IWikiPage, IWikiPageHierarchy
class WikiPageTraverser:
implements(IPublishTraverse)
@@ -34,19 +35,21 @@
self.request = request
def publishTraverse(self, request, name):
- subob = self.wiki.get(name, None)
+ page = self.wiki.get(name, None)
+
+ # Check that page has self.context as parent
+ if page is None or \
+ not zapi.getName(self.context) in IWikiPageHierarchy(page).parents:
- # XXX: Check that subobj has self.context as parent!
- if subob is None:
-
view = queryView(self.context, name, request)
if view is not None:
return view
raise NotFoundError(self.context, name, request)
- return removeAllProxies(subob)
+ return removeAllProxies(page)
+
def browserDefault(self, request):
c = self.context
view_name = getDefaultViewName(c, request)
Modified: Zope3/trunk/src/zope/app/wiki/wikipage.py
===================================================================
--- Zope3/trunk/src/zope/app/wiki/wikipage.py 2004-07-08 19:47:55 UTC (rev 26227)
+++ Zope3/trunk/src/zope/app/wiki/wikipage.py 2004-07-08 19:50:17 UTC (rev 26228)
@@ -23,6 +23,7 @@
from zope.app import zapi
from zope.app.container.btree import BTreeContainer
+from zope.app.container.contained import Contained
from zope.app.filerepresentation.interfaces import IReadFile
from zope.app.filerepresentation.interfaces import IWriteFile
from zope.app.filerepresentation.interfaces import IReadDirectory
@@ -43,14 +44,11 @@
SubscriberKey = 'http://www.zope.org/zwiki#1.0/MailSubscriptions/emails'
-class WikiPage(BTreeContainer):
+class WikiPage(BTreeContainer, Contained):
"""A persistent Wiki Page implementation."""
implements(IWikiPage, IWikiContained)
- # See zope.app.container.interfaces.IContained
- __parent__ = __name__ = None
-
def __init__(self, source=u''):
super(WikiPage, self).__init__()
self._source = source
@@ -96,7 +94,6 @@
def path(self):
"See zope.app.wiki.interfaces.IWikiPageHierarchy"
- # XXX: Allow for multpile parents
if not self.getParents():
return [self.context]
wiki = zapi.getParent(self.context)
@@ -318,7 +315,6 @@
"See zope.app.wiki.interfaces.IMailSubscriptions"
subscribers = list(self._annotations[SubscriberKey])
for email in emails:
- # XXX: Make sure these are actually E-mail addresses.
if email not in subscribers:
subscribers.append(email.strip())
self._annotations[SubscriberKey] = tuple(subscribers)
@@ -337,7 +333,6 @@
"""Class to handle all outgoing mail."""
def __call__(self, event):
- # XXX event handling should be separated from mailing
if IWikiPage.providedBy(event.object):
if IObjectAddedEvent.providedBy(event):
self.handleAdded(event.object)
More information about the Zope3-Checkins
mailing list