[Zope3-checkins] CVS: Products3/NewsSite/NewsItem - browser.py:1.4 info.pt:1.4
Volker Bachschneider
vbachs@dzug.org
Wed, 26 Mar 2003 13:41:55 -0500
Update of /cvs-repository/Products3/NewsSite/NewsItem
In directory cvs.zope.org:/tmp/cvs-serv21742
Modified Files:
browser.py info.pt
Log Message:
added to view: Creator
=== Products3/NewsSite/NewsItem/browser.py 1.3 => 1.4 ===
--- Products3/NewsSite/NewsItem/browser.py:1.3 Wed Mar 26 09:24:53 2003
+++ Products3/NewsSite/NewsItem/browser.py Wed Mar 26 13:41:54 2003
@@ -16,6 +16,11 @@
$Id$
"""
from interfaces import INewsItem
+from zope.component import getAdapter, getService
+from zope.app.interfaces.dublincore import ICMFDublinCore
+from zope.app.services import servicenames
+from zopeproducts.NewsSite.interfaces import IMember
+from zope.exceptions import NotFoundError
class NewsItemInfoView:
"""Provide an interface for viewing a news item
@@ -27,3 +32,13 @@
self.context = context
self.request = request
+ def getCreator(self):
+ user = getAdapter(self.context, ICMFDublinCore).Creator()
+ service = getService(self.context, servicenames.Authentication)
+ try:
+ user = service.getPrincipal(user)
+ member = getAdapter(user, IMember).realname
+ except NotFoundError:
+ member = u'Unknown'
+
+ return member
\ No newline at end of file
=== Products3/NewsSite/NewsItem/info.pt 1.3 => 1.4 ===
--- Products3/NewsSite/NewsItem/info.pt:1.3 Wed Mar 26 09:24:53 2003
+++ Products3/NewsSite/NewsItem/info.pt Wed Mar 26 13:41:54 2003
@@ -5,6 +5,7 @@
<body>
<div metal:fill-slot="body">
<h2 tal:content="context/title">News Message</h2>
+ <p> Creator: <em tal:content="view/getCreator">Creator</em></p>
<p> <em tal:content="context/lead">News Message</em></p>
<p> <pre tal:content="context/newsbody">News Message</pre></p>
<p>