diff --git a/browser/resource.py b/browser/resource.py index afe32f5..d18dfdb 100644 --- a/browser/resource.py +++ b/browser/resource.py @@ -28,7 +28,6 @@ from zope import component from zope.app import zapi from zope.app.catalog.interfaces import ICatalog from zope.app.container.interfaces import INameChooser -from zope.dublincore.interfaces import ICMFDublinCore from zope.app.form.browser.textwidgets import FileWidget from zope.app.pagetemplate import ViewPageTemplateFile from zope.app.security.interfaces import IUnauthenticatedPrincipal diff --git a/resource.py b/resource.py index b8c282a..feb0ccd 100644 --- a/resource.py +++ b/resource.py @@ -27,10 +27,11 @@ from zope.app import zapi from zope.app.container.btree import BTreeContainer from zope.app.container.contained import Contained from zope.app.file.image import Image -#from zope.app.file.interfaces import IFile +from zope.app.security.interfaces import IAuthentication from zope.filerepresentation.interfaces import IReadFile, IWriteFile from zope.cachedescriptors.property import Lazy from zope.component import adapts +from zope.dublincore.interfaces import IZopeDublinCore from zope.i18nmessageid import MessageFactory from zope.interface import implements from zope.size.interfaces import ISized @@ -458,8 +459,19 @@ class IndexAttributes(object): def title(self): context = self.context - return ' '.join((getName(context), - context.title, context.description)).strip() + return ' '.join([getName(context), + context.title, context.description] + + self.creators()).strip() + + def creators(self): + cr = IZopeDublinCore(self.context).creators or [] + pau = component.getUtility(IAuthentication) + creators = [] + for c in cr: + principal = pau.getPrincipal(c) + if principal is not None: + creators.append(principal.title) + return creators class ResourceTypeSourceList(object): diff --git a/tests/setup.py b/tests/setup.py index a937d88..c50c05c 100644 --- a/tests/setup.py +++ b/tests/setup.py @@ -5,11 +5,16 @@ $Id$ """ from zope import component +from zope.annotation.attribute import AttributeAnnotations from zope.app.catalog.catalog import Catalog from zope.app.catalog.interfaces import ICatalog from zope.app.catalog.field import FieldIndex from zope.app.catalog.text import TextIndex from zope.app.container.interfaces import IObjectRemovedEvent +from zope.app.security.principalregistry import principalRegistry +from zope.app.security.interfaces import IAuthentication +from zope.dublincore.annotatableadapter import ZDCAnnotatableAdapter +from zope.dublincore.interfaces import IZopeDublinCore from cybertools.relation.tests import IntIdsStub from cybertools.relation.registry import RelationRegistry @@ -45,6 +50,10 @@ class TestSite(object): component.provideUtility(relations, IRelationRegistry) component.provideAdapter(IndexableRelationAdapter) + component.provideAdapter(ZDCAnnotatableAdapter, (ILoopsObject,), IZopeDublinCore) + component.provideAdapter(AttributeAnnotations, (ILoopsObject,)) + component.provideUtility(principalRegistry, IAuthentication) + component.provideAdapter(LoopsType) component.provideAdapter(ConceptType) component.provideAdapter(ResourceType, (IDocument,))