[Zope3-checkins] CVS: zopeproducts/xml/browser - content.py:1.1 configure.zcml:1.2

Philipp von Weitershausen philikon@philikon.de
Sun, 22 Jun 2003 20:29:33 -0400


Update of /cvs-repository/zopeproducts/xml/browser
In directory cvs.zope.org:/tmp/cvs-serv21647

Modified Files:
	configure.zcml 
Added Files:
	content.py 
Log Message:
Added basic default view for DOM Document.


=== Added File zopeproducts/xml/browser/content.py ===
##############################################################################
#
# Copyright (c) 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.
#
##############################################################################
"""
DOM Document browser views

$Id: content.py,v 1.1 2003/06/23 00:29:33 philikon Exp $
"""

from zope.publisher.browser import BrowserView
from zope.proxy import removeAllProxies
from zope.app import zapi
from zope.app.interfaces.xml.source import IXMLText

class DOMDocumentView(BrowserView):

    def index(self):
        request = self.request
        request.response.setHeader('Content-Type', 'text/xml')
        return self.domAsString()

    def domAsString(self, prettyPrint=False):
        xmltext = zapi.getAdapter(self.context, IXMLText)
        return xmltext.source


=== zopeproducts/xml/browser/configure.zcml 1.1 => 1.2 ===
--- zopeproducts/xml/browser/configure.zcml:1.1	Fri Jun 20 18:16:48 2003
+++ zopeproducts/xml/browser/configure.zcml	Sun Jun 22 20:29:33 2003
@@ -11,4 +11,13 @@
   action="DOMDocument"
   description="XML storage using a persistent DOM tree" />
 
+<browser:pages
+  for="zopeproducts.xml.interfaces.dom.core.IDocument"
+  class=".content.DOMDocumentView"
+  permission="zope.View">
+
+  <browser:page name="index.html" attribute="index" />
+
+</browser:pages>
+
 </zopeConfigure>