[Zope3-checkins] CVS: Products3/NewsSite/NewsItem - interfaces.py:1.4 news.py:1.5

Volker Bachschneider vbachs@dzug.org
Wed, 26 Mar 2003 05:52:50 -0500


Update of /cvs-repository/Products3/NewsSite/NewsItem
In directory cvs.zope.org:/tmp/cvs-serv21465

Modified Files:
	interfaces.py news.py 
Log Message:
added: effective and expires, schema Datetime is broken


=== Products3/NewsSite/NewsItem/interfaces.py 1.3 => 1.4 ===
--- Products3/NewsSite/NewsItem/interfaces.py:1.3	Tue Mar 25 12:47:13 2003
+++ Products3/NewsSite/NewsItem/interfaces.py	Wed Mar 26 05:52:50 2003
@@ -1,5 +1,5 @@
 from zope.interface import Interface
-from zope.schema import Text, TextLine
+from zope.schema import Text, TextLine, Datetime
 
 class INewsItem(Interface):
     "Describes the representation of a news item."
@@ -9,3 +9,7 @@
     lead = Text(title=u"News Lead")
 
     newsbody = Text(title=u"News Message")
+
+#    effective = Datetime(title=u"Effective")
+
+#    expires = Datetime(title=u"Expires") 


=== Products3/NewsSite/NewsItem/news.py 1.4 => 1.5 ===
--- Products3/NewsSite/NewsItem/news.py:1.4	Tue Mar 25 12:47:13 2003
+++ Products3/NewsSite/NewsItem/news.py	Wed Mar 26 05:52:50 2003
@@ -9,12 +9,10 @@
 
     __implements__ = INewsItem
 
-    def __init__(self, title=u"", lead=u"", newsbody=""):
+    def __init__(self, newsbody=""):
         # XXX We don't know why setting newsbody=u"" does 
         #     not save the newsbody value typed in in the 
         #     form.
-        self.title = title
-        self.lead = lead
         self.newsbody = newsbody
 
     def _get_title(self):
@@ -35,5 +33,25 @@
 
     lead = property(_get_lead, _set_lead, None, 
                      "getting and setting the lead gets and "
+                     "sets the dublin core description")
+
+    def _get_effective(self):
+        return getAdapter(self, IZopeDublinCore).effective
+        
+    def _set_effective(self, value):
+        getAdapter(self, IZopeDublinCore).effective = value
+
+    effective = property(_get_effective, _set_effective, None, 
+                     "getting and setting the effective gets and "
+                     "sets the dublin core description")
+
+    def _get_expires(self):
+        return getAdapter(self, IZopeDublinCore).expires
+        
+    def _set_expires(self, value):
+        getAdapter(self, IZopeDublinCore).expires = value
+
+    expires = property(_get_expires, _set_expires, None, 
+                     "getting and setting the expires gets and "
                      "sets the dublin core description")