[Zope-CVS] CVS: Packages/Moztop/idesupport/xmlrpc - image.py:1.1 configure.zcml:1.2
Stephan Richter
srichter@cbu.edu
Thu, 16 Jan 2003 04:56:09 -0500
Update of /cvs-repository/Packages/Moztop/idesupport/xmlrpc
In directory cvs.zope.org:/tmp/cvs-serv24088/idesupport/xmlrpc
Modified Files:
configure.zcml
Added Files:
image.py
Log Message:
- We now have the sense of a first static TypeRegistry. Much more work is
needed in this area.
- If you have an image, you can now save its meta data and see the Upload
screen. Trying to open the File Picker somehow crashes my Mozilla.
- All types that Zope supports are now listed and can be handled in the
contents.rdf file.
=== Added File Packages/Moztop/idesupport/xmlrpc/image.py ===
##############################################################################
#
# Copyright (c) 2002, 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""
$Id: image.py,v 1.1 2003/01/16 09:55:37 srichter Exp $
"""
import datetime
from zope.component import getAdapter
from zope.publisher.xmlrpc import MethodPublisher
from zope.app.interfaces.dublincore import IZopeDublinCore
class Methods(MethodPublisher):
""" """
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 "Meta Data successfully changed."
=== Packages/Moztop/idesupport/xmlrpc/configure.zcml 1.1 => 1.2 ===
--- Packages/Moztop/idesupport/xmlrpc/configure.zcml:1.1 Tue Jan 14 15:42:26 2003
+++ Packages/Moztop/idesupport/xmlrpc/configure.zcml Thu Jan 16 04:55:37 2003
@@ -7,6 +7,13 @@
for="zope.app.interfaces.container.IContentContainer"
factory=".folder.Methods"
permission="Zope.Manage"
- allowed_methods="objectIds, createAndAdd"/>
+ allowed_methods="objectIds, createAndAdd, getMetaData, setMetaData"/>
+
+ <xmlrpc:view
+ name="methods"
+ for="zope.app.interfaces.content.image.IImage"
+ factory=".image.Methods"
+ permission="Zope.Manage"
+ allowed_methods="getMetaData, setMetaData"/>
</zopeConfigure>