[Zope3-checkins] CVS: Zope3/src/zope/app/wiki/browser - wiki.py:1.4 wikipage.py:1.4

Jim Fulton jim at zope.com
Sat Mar 6 11:51:06 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/wiki/browser
In directory cvs.zope.org:/tmp/cvs-serv11249/src/zope/app/wiki/browser

Modified Files:
	wiki.py wikipage.py 
Log Message:
Converted most getAdapter calls to use interface calls instead.


=== Zope3/src/zope/app/wiki/browser/wiki.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/wiki/browser/wiki.py:1.3	Tue Mar  2 09:25:03 2004
+++ Zope3/src/zope/app/wiki/browser/wiki.py	Sat Mar  6 11:50:35 2004
@@ -47,7 +47,7 @@
                 zapi.createObject(None, 'zope.wiki.WikiPage'))
             page.type = u'zope.source.rest'
             page.source = u'This is the FrontPage of the Wiki.'
-            dc = zapi.getAdapter(page, ICMFDublinCore)
+            dc = ICMFDublinCore(page)
             dc.created = datetime.now()
             dc.modified = datetime.now()
             dc.creators = [u'wiki']
@@ -83,7 +83,7 @@
         children = []
 
         for name, page in self.context.items():
-            hier = zapi.getAdapter(page, IWikiPageHierarchy)
+            hier = IWikiPageHierarchy(page)
             if hier.getParents() == ():
                 children.append((page, hier.findChildren())) 
         return self._branchHTML(children)


=== Zope3/src/zope/app/wiki/browser/wikipage.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/wiki/browser/wikipage.py:1.3	Tue Mar  2 09:25:03 2004
+++ Zope3/src/zope/app/wiki/browser/wikipage.py	Sat Mar  6 11:50:35 2004
@@ -54,16 +54,16 @@
 
     def author(self):
         """Get user who last modified the Wiki Page."""
-        creators = zapi.getAdapter(self.context, ICMFDublinCore).creators
+        creators = ICMFDublinCore(self.context).creators
         if not creators:
             return 'unknown'
         return creators[0]
 
     def modified(self):
         """Get last modification date."""
-        date = zapi.getAdapter(self.context, ICMFDublinCore).modified
+        date = ICMFDublinCore(self.context).modified
         if date is None:
-            date = zapi.getAdapter(self.context, ICMFDublinCore).created
+            date = ICMFDublinCore(self.context).created
         if date is None:
             return ''
         formatter = self.request.locale.dates.getFormatter('dateTime', 'medium')
@@ -75,7 +75,7 @@
     
     def breadcrumbs(self):
         """Get the path of this page."""
-        hier = zapi.getAdapter(self.context, IWikiPageHierarchy)
+        hier = IWikiPageHierarchy(self.context)
         path = hier.path()
         html = []
         for page in path:
@@ -267,7 +267,7 @@
 class EditWikiParents:
 
     def parents(self):
-        hier = zapi.getAdapter(self.context, IWikiPageHierarchy)
+        hier = IWikiPageHierarchy(self.context)
         return hier.parents
 
     def availableWikis(self):
@@ -275,7 +275,7 @@
         return wiki.keys()
 
     def setParents(self, parents):
-        hier = zapi.getAdapter(self.context, IWikiPageHierarchy)
+        hier = IWikiPageHierarchy(self.context)
         hier.reparent(parents)
         return self.request.response.redirect('./@@parents.html')
 
@@ -290,7 +290,7 @@
         return html
 
     def branch(self):
-        hier = zapi.getAdapter(self.context, IWikiPageHierarchy)
+        hier = IWikiPageHierarchy(self.context)
         children = hier.findChildren()
         return self._branchHTML(children)
 
@@ -306,20 +306,17 @@
 class MailSubscriptions:
 
     def subscriptions(self):
-        return zapi.getAdapter(self.context,
-                               IMailSubscriptions).getSubscriptions()
+        return IMailSubscriptions(self.context).getSubscriptions()
 
     def change(self):
         if 'ADD' in self.request:
             emails = self.request['emails'].split('\n')
-            zapi.getAdapter(self.context,
-                            IMailSubscriptions).addSubscriptions(emails)
+            IMailSubscriptions(self.context).addSubscriptions(emails)
         elif 'REMOVE' in self.request:
             emails = self.request['remails']
             print emails
             if isinstance(emails, (str, unicode)):
                 emails = [emails]
-            zapi.getAdapter(self.context,
-                            IMailSubscriptions).removeSubscriptions(emails)
+                IMailSubscriptions(self.context).removeSubscriptions(emails)
 
         self.request.response.redirect('.')




More information about the Zope3-Checkins mailing list