[Zope3-checkins] CVS: zopeproducts/xml - domdocument.py:1.1 configure.zcml:1.2
Philipp von Weitershausen
philikon@philikon.de
Fri, 20 Jun 2003 18:17:19 -0400
Update of /cvs-repository/zopeproducts/xml
In directory cvs.zope.org:/tmp/cvs-serv15620
Modified Files:
configure.zcml
Added Files:
domdocument.py
Log Message:
Made a dom.core.Document a content class now that it is persistent. For now
we only have a factory and a menu entry for it.
=== Added File zopeproducts/xml/domdocument.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
$Id: domdocument.py,v 1.1 2003/06/20 22:16:48 philikon Exp $
"""
from StringIO import StringIO
from zope.interface import implements
from zope.component.interfaces import IFactory
from zopeproducts.xml.interfaces.dom.core import IDocument
from zopeproducts.xml.dom import expatbuilder
class DOMDocumentFactory:
implements(IFactory)
def getInterfaces(self):
return (IDocument,)
def __call__(self, xmlsource='<doc/>'):
f = StringIO(xmlsource)
return expatbuilder.parse(f)
domDocumentFactory = DOMDocumentFactory()
=== zopeproducts/xml/configure.zcml 1.1 => 1.2 ===
--- zopeproducts/xml/configure.zcml:1.1 Fri Jun 20 11:11:37 2003
+++ zopeproducts/xml/configure.zcml Fri Jun 20 18:16:48 2003
@@ -2,6 +2,32 @@
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser">
+<!-- DOM Document directives -->
+
+<content class="zopeproducts.xml.dom.core.Document">
+ <require
+ permission="zope.ManageContent"
+ interface="zopeproducts.xml.interfaces.dom.core.IDocument" />
+
+ <implements
+ interface="zope.app.interfaces.annotation.IAttributeAnnotatable" />
+</content>
+
+<!-- We need to provide our own factory for DOM Document because
+ we cannot instanciate a DOM node ourselves. Instead, we have
+ to use one of the builders -->
+
+<factory
+ id="DOMDocument"
+ component=".domdocument.domDocumentFactory"
+ permission="zope.ManageContent" />
+
+
+<!-- include sub-packages -->
+
+<include package=".browser" />
+
+
<!-- remove the comments to enable the XSLT package -->
<!-- <include package=".xslt" /> -->