[Zope3-checkins] CVS: zopeproducts/NewsSite/NewsItem - browser.py:1.10 news.py:1.8
Philipp von Weitershausen
philikon@philikon.de
Wed, 25 Jun 2003 11:31:05 -0400
Update of /cvs-repository/zopeproducts/NewsSite/NewsItem
In directory cvs.zope.org:/tmp/cvs-serv4672/NewsItem
Modified Files:
browser.py news.py
Log Message:
Made the NewsSite product work again (don't expect too much, though):
- update according to changes in Zope3 head (configuration
-> registration)
- use new-style implements
- use zapi convenience module
- disable some faulty unit tests
- whitespace normalization (please stop using tabs!)
=== zopeproducts/NewsSite/NewsItem/browser.py 1.9 => 1.10 ===
--- zopeproducts/NewsSite/NewsItem/browser.py:1.9 Thu Mar 27 13:11:35 2003
+++ zopeproducts/NewsSite/NewsItem/browser.py Wed Jun 25 11:30:34 2003
@@ -15,13 +15,14 @@
$Id$
"""
-from interfaces import INewsItem
-from zope.component import getAdapter, getService
+from zope.app import zapi
from zope.app.interfaces.dublincore import ICMFDublinCore
from zope.app.services import servicenames
from zopeproducts.NewsSite.interfaces import IMember
from zope.exceptions import NotFoundError
+from interfaces import INewsItem
+
class NewsItemInfoView:
"""Provide an interface for viewing a news item
"""
@@ -33,15 +34,15 @@
self.request = request
def getCreator(self):
- users = getAdapter(self.context, ICMFDublinCore).Creator()
- service = getService(self.context, servicenames.Authentication)
+ users = zapi.getAdapter(self.context, ICMFDublinCore).Creator()
+ service = zapi.getService(self.context, servicenames.Authentication)
members = []
for user in users:
principal = None
username = None
try:
principal = service.getPrincipal(user)
- username += getAdapter(principal, IMember).realname
+ username += zapi.getAdapter(principal, IMember).realname
except NotFoundError:
if principal:
username = principal.getTitle()
@@ -55,23 +56,23 @@
def title(self):
- return getAdapter(self.context,ICMFDublinCore).title
+ return zapi.getAdapter(self.context,ICMFDublinCore).title
def createdString(self):
- return self._dateString(getAdapter(self.context,
+ return self._dateString(zapi.getAdapter(self.context,
ICMFDublinCore).created)
def modifiedString(self):
- return self._dateString(getAdapter(self.context,
+ return self._dateString(zapi.getAdapter(self.context,
ICMFDublinCore).modified)
def effectiveString(self):
- return self._dateString(getAdapter(self.context,
+ return self._dateString(zapi.getAdapter(self.context,
ICMFDublinCore).effective)
def expiresString(self):
- return self._dateString(getAdapter(self.context,
+ return self._dateString(zapi.getAdapter(self.context,
ICMFDublinCore).expires)
def _dateString(self, value):
=== zopeproducts/NewsSite/NewsItem/news.py 1.7 => 1.8 ===
--- zopeproducts/NewsSite/NewsItem/news.py:1.7 Thu Mar 27 13:05:03 2003
+++ zopeproducts/NewsSite/NewsItem/news.py Wed Jun 25 11:30:34 2003
@@ -16,15 +16,15 @@
$Id$
"""
import persistence
+from zope.interface import implements
from zope.app.dublincore.annotatableadapter import ZDCAnnotatableAdapter
-from interfaces import INewsItem
-from interfaces import INewsItemForm
+
+from interfaces import INewsItem, INewsItemForm
class NewsItem(persistence.Persistent):
"""News Item.
"""
-
- __implements__ = INewsItem
+ implements(INewsItem)
def __init__(self, teaser=u"", body=u""):
self.teaser = teaser
@@ -33,8 +33,7 @@
class NewsItemAttributesAdapter(ZDCAnnotatableAdapter):
"""
"""
-
- __implements__ = INewsItemForm
+ implements(INewsItemForm)
__used_for__ = INewsItem
def __init__(self, context):