[Zope-CVS] CVS: Packages/Moztop/idesupport/xmlrpc - dtmlpage.py:1.1 configure.zcml:1.6

Stephan Richter srichter@cbu.edu
Thu, 16 Jan 2003 10:25:58 -0500


Update of /cvs-repository/Packages/Moztop/idesupport/xmlrpc
In directory cvs.zope.org:/tmp/cvs-serv5049/idesupport/xmlrpc

Modified Files:
	configure.zcml 
Added Files:
	dtmlpage.py 
Log Message:
Making DTML Page work. Now you can edit it as well.


=== Added File Packages/Moztop/idesupport/xmlrpc/dtmlpage.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: dtmlpage.py,v 1.1 2003/01/16 15:25:25 srichter Exp $
"""
import datetime, StringIO
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."

    
    def setDTMLSource(self, source):
        """ """
        self.context.source = unicode(source)


    def getDTMLSource(self):
        """ """
        return self.context.getSource()


=== Packages/Moztop/idesupport/xmlrpc/configure.zcml 1.5 => 1.6 ===
--- Packages/Moztop/idesupport/xmlrpc/configure.zcml:1.5	Thu Jan 16 09:42:30 2003
+++ Packages/Moztop/idesupport/xmlrpc/configure.zcml	Thu Jan 16 10:25:25 2003
@@ -30,4 +30,11 @@
       permission="Zope.Manage"
       allowed_methods="getMetaData, setMetaData, setSource, getSource"/>
 
+  <xmlrpc:view 
+      name="methods"
+      for="zope.app.interfaces.content.dtmlpage.IDTMLPage"
+      factory=".dtmlpage.Methods"
+      permission="Zope.Manage"
+      allowed_methods="getMetaData,setMetaData,setDTMLSource,getDTMLSource"/>
+
 </zopeConfigure>