[Zope-CVS] CVS: Packages/Moztop/idesupport/xmlrpc - folder.py:1.3
Stephan Richter
srichter@cbu.edu
Wed, 15 Jan 2003 21:07:02 -0500
Update of /cvs-repository/Packages/Moztop/idesupport/xmlrpc
In directory cvs.zope.org:/tmp/cvs-serv25997/idesupport/xmlrpc
Modified Files:
folder.py
Log Message:
- Got editing of Folder Meta Data working nicely. This required grabbing
another Window's document object, which I finally got working.
- Added .cvsignore file in moztop/content, so I could hide setup.js.
- Updated Makefile to remove .cvsignore files when making a distro.
- Updated CHANGES.txt.
=== Packages/Moztop/idesupport/xmlrpc/folder.py 1.2 => 1.3 ===
--- Packages/Moztop/idesupport/xmlrpc/folder.py:1.2 Tue Jan 14 20:26:34 2003
+++ Packages/Moztop/idesupport/xmlrpc/folder.py Wed Jan 15 21:06:30 2003
@@ -15,10 +15,12 @@
$Id$
"""
+import datetime
from zope.component import createObject, getAdapter
from zope.publisher.xmlrpc import MethodPublisher
from zope.publisher.interfaces.xmlrpc import IXMLRPCPublisher
+from zope.app.interfaces.dublincore import IZopeDublinCore
from zope.app.interfaces.container import IZopeContainer
class Methods(MethodPublisher):
@@ -31,6 +33,39 @@
def createAndAdd(self, type, name):
"""Create and add an object to the folder."""
content = createObject(self, type)
+ dc = getAdapter(content, IZopeDublinCore)
+ dc.created = datetime.datetime.now()
+ dc.modified = datetime.datetime.now()
container = getAdapter(self.context, IZopeContainer)
name = container.setObject(name, content)
return "A %s with name '%s' was successfully added!" %(type, name)
+
+ def getMetaData(self):
+ """Return a dictionary of all meta data."""
+ dc = getAdapter(self.context, IZopeDublinCore)
+
+ if dc.modified is not None:
+ modified = dc.modified.strftime('%Y/%m/%d %H:%M:%S')
+ else:
+ modified = 'N/A'
+
+ if dc.created is not None:
+ created = dc.created.strftime('%Y/%m/%d %H:%M:%S')
+ else:
+ created = 'N/A'
+
+ return {
+ 'title': dc.title,
+ 'description': dc.description,
+ 'modified': modified,
+ 'created': created
+ }
+
+ def setMetaData(self, title, description):
+ """Set the new meta data."""
+ dc = getAdapter(self.context, IZopeDublinCore)
+ dc.title = unicode(title)
+ dc.description = unicode(description)
+ dc.modified = datetime.datetime.now()
+ return 1
+