add creator name to title index
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@1795 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
20b2bf4e5d
commit
9d89ab30ec
3 changed files with 24 additions and 4 deletions
|
@ -28,7 +28,6 @@ from zope import component
|
||||||
from zope.app import zapi
|
from zope.app import zapi
|
||||||
from zope.app.catalog.interfaces import ICatalog
|
from zope.app.catalog.interfaces import ICatalog
|
||||||
from zope.app.container.interfaces import INameChooser
|
from zope.app.container.interfaces import INameChooser
|
||||||
from zope.dublincore.interfaces import ICMFDublinCore
|
|
||||||
from zope.app.form.browser.textwidgets import FileWidget
|
from zope.app.form.browser.textwidgets import FileWidget
|
||||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
from zope.app.pagetemplate import ViewPageTemplateFile
|
||||||
from zope.app.security.interfaces import IUnauthenticatedPrincipal
|
from zope.app.security.interfaces import IUnauthenticatedPrincipal
|
||||||
|
|
18
resource.py
18
resource.py
|
@ -27,10 +27,11 @@ from zope.app import zapi
|
||||||
from zope.app.container.btree import BTreeContainer
|
from zope.app.container.btree import BTreeContainer
|
||||||
from zope.app.container.contained import Contained
|
from zope.app.container.contained import Contained
|
||||||
from zope.app.file.image import Image
|
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.filerepresentation.interfaces import IReadFile, IWriteFile
|
||||||
from zope.cachedescriptors.property import Lazy
|
from zope.cachedescriptors.property import Lazy
|
||||||
from zope.component import adapts
|
from zope.component import adapts
|
||||||
|
from zope.dublincore.interfaces import IZopeDublinCore
|
||||||
from zope.i18nmessageid import MessageFactory
|
from zope.i18nmessageid import MessageFactory
|
||||||
from zope.interface import implements
|
from zope.interface import implements
|
||||||
from zope.size.interfaces import ISized
|
from zope.size.interfaces import ISized
|
||||||
|
@ -458,8 +459,19 @@ class IndexAttributes(object):
|
||||||
|
|
||||||
def title(self):
|
def title(self):
|
||||||
context = self.context
|
context = self.context
|
||||||
return ' '.join((getName(context),
|
return ' '.join([getName(context),
|
||||||
context.title, context.description)).strip()
|
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):
|
class ResourceTypeSourceList(object):
|
||||||
|
|
|
@ -5,11 +5,16 @@ $Id$
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope import component
|
from zope import component
|
||||||
|
from zope.annotation.attribute import AttributeAnnotations
|
||||||
from zope.app.catalog.catalog import Catalog
|
from zope.app.catalog.catalog import Catalog
|
||||||
from zope.app.catalog.interfaces import ICatalog
|
from zope.app.catalog.interfaces import ICatalog
|
||||||
from zope.app.catalog.field import FieldIndex
|
from zope.app.catalog.field import FieldIndex
|
||||||
from zope.app.catalog.text import TextIndex
|
from zope.app.catalog.text import TextIndex
|
||||||
from zope.app.container.interfaces import IObjectRemovedEvent
|
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.tests import IntIdsStub
|
||||||
from cybertools.relation.registry import RelationRegistry
|
from cybertools.relation.registry import RelationRegistry
|
||||||
|
@ -45,6 +50,10 @@ class TestSite(object):
|
||||||
component.provideUtility(relations, IRelationRegistry)
|
component.provideUtility(relations, IRelationRegistry)
|
||||||
component.provideAdapter(IndexableRelationAdapter)
|
component.provideAdapter(IndexableRelationAdapter)
|
||||||
|
|
||||||
|
component.provideAdapter(ZDCAnnotatableAdapter, (ILoopsObject,), IZopeDublinCore)
|
||||||
|
component.provideAdapter(AttributeAnnotations, (ILoopsObject,))
|
||||||
|
component.provideUtility(principalRegistry, IAuthentication)
|
||||||
|
|
||||||
component.provideAdapter(LoopsType)
|
component.provideAdapter(LoopsType)
|
||||||
component.provideAdapter(ConceptType)
|
component.provideAdapter(ConceptType)
|
||||||
component.provideAdapter(ResourceType, (IDocument,))
|
component.provideAdapter(ResourceType, (IDocument,))
|
||||||
|
|
Loading…
Add table
Reference in a new issue