[Zope-CVS] CVS: Packages/Moztop/moztopsupport/xml - __init__.py:1.1 configure.zcml:1.1 container.py:1.1
Sidnei da Silva
sidnei@x3ng.com.br
Thu, 20 Mar 2003 13:24:29 -0500
Update of /cvs-repository/Packages/Moztop/moztopsupport/xml
In directory cvs.zope.org:/tmp/cvs-serv22557/moztopsupport/xml
Added Files:
__init__.py configure.zcml container.py
Log Message:
Big refactoring. Renamed idesupport to moztop support. Adding a utility to get Resource Types
=== Added File Packages/Moztop/moztopsupport/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.
#
##############################################################################
__doc__ = """ XML Support for Moztop Extension Product
$Id: __init__.py,v 1.1 2003/03/20 18:24:28 sidnei Exp $
"""
=== Added File Packages/Moztop/moztopsupport/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="homePageLink contentsURL resourcetypesURL getTitle"
>
<browser:page name="rsd.xml" attribute="rsd" />
</browser:pages>
</zopeConfigure>
=== Added File Packages/Moztop/moztopsupport/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.
#
##############################################################################
__doc__ = """ Site Configuration XML View.
$Id: container.py,v 1.1 2003/03/20 18:24:28 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.app.interfaces.traversing import IObjectName
from zope.component import getView, getService, getAdapter
class Config(BrowserView):
"""Displays Site Configuration in XML format"""
# A Site is a ServiceManagerContainer
__used_for__ = IServiceManagerContainer
def homePageLink(self):
context = self.context
url = str(getView(context, 'absolute_url', self.request))
return url
def contentsURL(self):
return '%s/%s' % (self.homePageLink(), 'contents.rdf')
def resourcetypesURL(self):
return '%s/%s' % (self.homePageLink(), 'resource_types.rdf')
def getTitle(self):
context = self.context
dc = getAdapter(context, IZopeDublinCore)
title = dc.title
if not title:
title = str(getAdapter(context, IObjectName))
if not title:
title = str(getView(context, 'absolute_url', self.request))
return title
def rsd(self):
self.request.response.setHeader('content-type', 'text/xml')
return self._rsd()
_rsd = ViewPageTemplateFile("rsd.pt")