[Zope-CVS] CVS: Packages/Moztop/idesupport/xmlrpc - zptpage.py:1.1 configure.zcml:1.4
Stephan Richter
srichter@cbu.edu
Thu, 16 Jan 2003 08:50:04 -0500
Update of /cvs-repository/Packages/Moztop/idesupport/xmlrpc
In directory cvs.zope.org:/tmp/cvs-serv24810/idesupport/xmlrpc
Modified Files:
configure.zcml
Added Files:
zptpage.py
Log Message:
Now ZPT Views work. You can edit the source and preview it. Works really
nice.
=== Added File Packages/Moztop/idesupport/xmlrpc/zptpage.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: zptpage.py,v 1.1 2003/01/16 13:49:32 srichter Exp $
"""
import datetime, StringIO
from zope.component import getAdapter
from zope.publisher.xmlrpc import MethodPublisher
from zope.app.interfaces.dublincore import IZopeDublinCore
from zope.app.content.image import ImageSized
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."
def setZPTSource(self, source):
""" """
self.context.source = unicode(source)
def getZPTSource(self):
""" """
return self.context.getSource()
=== Packages/Moztop/idesupport/xmlrpc/configure.zcml 1.3 => 1.4 ===
--- Packages/Moztop/idesupport/xmlrpc/configure.zcml:1.3 Thu Jan 16 07:46:42 2003
+++ Packages/Moztop/idesupport/xmlrpc/configure.zcml Thu Jan 16 08:49:32 2003
@@ -16,4 +16,11 @@
permission="Zope.Manage"
allowed_methods="getMetaData, setMetaData, upload"/>
+ <xmlrpc:view
+ name="methods"
+ for="zope.app.interfaces.content.zpt.IZPTPage"
+ factory=".zptpage.Methods"
+ permission="Zope.Manage"
+ allowed_methods="getMetaData, setMetaData, setSource, getSource"/>
+
</zopeConfigure>