[Zope-CVS] CVS: Packages/Moztop/idesupport/rdf - adapter.py:1.2 container.py:1.8
Sidnei da Silva
sidnei@x3ng.com.br
Mon, 10 Mar 2003 09:45:00 -0500
Update of /cvs-repository/Packages/Moztop/idesupport/rdf
In directory cvs.zope.org:/tmp/cvs-serv341/idesupport/rdf
Modified Files:
adapter.py container.py
Log Message:
Enabling ++etc++Services under configurations
=== Packages/Moztop/idesupport/rdf/adapter.py 1.1 => 1.2 ===
--- Packages/Moztop/idesupport/rdf/adapter.py:1.1 Sat Mar 8 15:00:33 2003
+++ Packages/Moztop/idesupport/rdf/adapter.py Mon Mar 10 09:44:55 2003
@@ -15,7 +15,9 @@
object."""
obj = self.context
- return obj.__class__.__name__
+ name = obj.__class__.__name__
+ name = name.lower()
+ return name
def getInfo(self, id, request, _prefix=''):
context = self.context
@@ -24,7 +26,7 @@
if _prefix:
if not _prefix.startswith(':'):
_prefix = ':' + _prefix
- if not _prefix.endswith(':'):
+ if id and not _prefix.endswith(':'):
_prefix = _prefix + ':'
fillIn = {'title' : dc.title or id,
'rdf_url' : _prefix + id ,
=== Packages/Moztop/idesupport/rdf/container.py 1.7 => 1.8 ===
--- Packages/Moztop/idesupport/rdf/container.py:1.7 Sat Mar 8 15:00:33 2003
+++ Packages/Moztop/idesupport/rdf/container.py Mon Mar 10 09:44:55 2003
@@ -17,11 +17,14 @@
"""
from zope.app.browser.container.adding import Adding
from zope.component import getFactoryInterfaces, getService, getView, queryAdapter, getAdapter
-from zope.app.interfaces.container import IContainer, IZopeContainer
+from zope.app.interfaces.container import IContainer, IReadContainer, IZopeContainer
+from zope.app.interfaces.services.service import IServiceManagerContainer
+from zope.proxy.context import ContextWrapper
from zope.publisher.browser import BrowserView
from zope.app.content.folder import RootFolder
from interfaces import IRDFNode, IRDFContainer
from zope.proxy.introspection import removeAllProxies
+from zope.app.traversing import traverse
class Contents(BrowserView):
"""Displays Container content (generated recursively) in Moztop-readable
@@ -56,12 +59,12 @@
rdf += _sub_nodes % ({'realm':realm, 'rdf_url':fillIn['rdf_url'],
'subs_rdf':subs_rdf})
- if fillIn and queryAdapter(base, IZopeContainer):
- container = getAdapter(base, IZopeContainer)
- items = container.items()
+ if fillIn and IReadContainer.isImplementedBy(base):
+ items = base.items()
_prefix = fillIn['rdf_url'] or ':'
for id, obj in items:
- rdf += self._makeSubtree(id, obj,
+ w_obj = ContextWrapper(obj, base, name=id)
+ rdf += self._makeSubtree(id, w_obj,
_prefix)
return rdf
@@ -73,7 +76,13 @@
view = getView(context, 'config.xml', self.request)
self.realm = view.getRealm()
rdf = _rdf_start
- rdf += self._makeSubtree('', self.context)
+ rdf += self._makeSubtree('', self.context, prefix='content')
+ if queryAdapter(self.context, IServiceManagerContainer):
+ smc = getAdapter(self.context, IServiceManagerContainer)
+ sm = smc.queryServiceManager(None)
+ if sm is not None:
+ sm = ContextWrapper(sm, self.context, name='++etc++Services')
+ rdf += self._makeSubtree('', sm, prefix='configurations')
rdf += _rdf_end
self.request.response.setHeader('Content-Type', 'text/xml')
return rdf
@@ -94,18 +103,18 @@
_node = '''
<rdf:description
- rdf:about="urn:moztop:sites:%(realm)s:content%(rdf_url)s">
+ rdf:about="urn:moztop:sites:%(realm)s%(rdf_url)s">
<dc:title>%(title)s</dc:title>
<dc:identifier>%(identifier)s</dc:identifier>
<site:resourcetype resource="urn:moztop:resourcetypes:%(type)s"/>
</rdf:description>
'''
-_sub_node = '''<rdf:li resource="urn:moztop:sites:%(realm)s:content%(rdf_url)s"/>'''
+_sub_node = '''<rdf:li resource="urn:moztop:sites:%(realm)s%(rdf_url)s"/>'''
_sub_nodes = '''\
<rdf:description
- rdf:about="urn:moztop:sites:%(realm)s:content%(rdf_url)s">
+ rdf:about="urn:moztop:sites:%(realm)s%(rdf_url)s">
<nc:subitems>
<rdf:seq>
%(subs_rdf)s