[Zope-CVS] CVS: Packages/Moztop/idesupport/xml - __init__.py:1.1 config.pt:1.1 configure.zcml:1.1 container.py:1.1
Sidnei da Silva
sidnei@x3ng.com.br
Sat, 8 Mar 2003 15:00:36 -0500
Update of /cvs-repository/Packages/Moztop/idesupport/xml
In directory cvs.zope.org:/tmp/cvs-serv6471/idesupport/xml
Added Files:
__init__.py config.pt configure.zcml container.py
Log Message:
re-enabling zope3 support.
=== Added File Packages/Moztop/idesupport/xml/__init__.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.
#
##############################################################################
"""Moztop Extension Product
$Id: __init__.py,v 1.1 2003/03/08 20:00:34 sidnei Exp $
"""
=== Added File Packages/Moztop/idesupport/xml/config.pt ===
<?xml version="1.0"?>
<configuration xmlns:dc="http://www.purl.org/dc/1.1#"
xmlns:tal="http://xml.zope.org/namespaces/tal">
<realm tal:content="view/getRealm">myplone</realm>
<dc:title tal:content="view/getTitle">My Site</dc:title>
</configuration>
=== Added File Packages/Moztop/idesupport/xml/configure.zcml ===
<zopeConfigure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser" >
<browser:pages
for="zope.app.interfaces.services.service.IServiceManagerContainer"
class=".container.Config"
permission="zope.ManageContent"
allowed_attributes="getRealm getTitle"
>
<browser:page name="config.xml" attribute="config" />
</browser:pages>
</zopeConfigure>
=== Added File Packages/Moztop/idesupport/xml/container.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.
#
##############################################################################
"""Site Configuration XML View.
$Id: container.py,v 1.1 2003/03/08 20:00:34 sidnei Exp $
"""
from zope.app.interfaces.container import IContainer, IZopeContainer
from zope.app.interfaces.traversing import IPhysicallyLocatable
from zope.app.interfaces.services.service import IServiceManagerContainer
from zope.app.interfaces.dublincore import IZopeDublinCore
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
from zope.app.content.folder import RootFolder
from zope.publisher.browser import BrowserView
from zope.component import getView, getService, getAdapter
import md5
class Config(BrowserView):
"""Displays Site Configuration in XML format"""
# A Site is a ServiceManagerContainer
__used_for__ = IServiceManagerContainer
def getRealm(self):
context = self.context
url = str(getView(context, 'absolute_url', self.request))
dc = getAdapter(context, IZopeDublinCore)
identifier = '%s#%s' % (url, str(dc.created))
hash = md5.new(identifier).digest()
func = lambda x: hex( ord( x ) )[2:]
md5_sum = '0' + ''.join( map( func, hash ) )
return md5_sum
def getTitle(self):
context = self.context
dc = getAdapter(context, IZopeDublinCore)
title = dc.title
if not title:
title = str(getView(context, 'absolute_url', self.request))
return title
def config(self):
self.request.response.setHeader('content-type', 'text/xml')
return self._config()
_config = ViewPageTemplateFile("config.pt")