fix indexing stuff (externalIdentifier)

This commit is contained in:
Helmut Merz 2017-10-08 12:56:31 +02:00
parent 37d508cec2
commit 181846b29a
2 changed files with 9 additions and 4 deletions

View file

@ -463,7 +463,10 @@ class IndexAttributes(object):
#if self.adapted != self.context: #if self.adapted != self.context:
if isinstance(self.adapted, AdapterBase): if isinstance(self.adapted, AdapterBase):
#return component.queryAdapter(self.adapted, IIndexAttributes) #return component.queryAdapter(self.adapted, IIndexAttributes)
return IIndexAttributes(self.adapted, None) iattr = IIndexAttributes(self.adapted, None)
if iattr.__class__ == self.__class__:
return None
return iattr
def text(self): def text(self):
if self.adaptedIndexAttributes is not None: if self.adaptedIndexAttributes is not None:

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2011 Helmut Merz helmutm@cy55.de # Copyright (c) 2017 Helmut Merz helmutm@cy55.de
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -25,7 +25,7 @@ from zope import interface, component
from zope.interface import implements from zope.interface import implements
from zope.component import adapts from zope.component import adapts
from loops.common import adapted from loops.common import adapted, AdapterBase
from loops.interfaces import ILoopsObject from loops.interfaces import ILoopsObject
from loops.integrator.interfaces import IExternalSourceInfo from loops.integrator.interfaces import IExternalSourceInfo
@ -47,7 +47,9 @@ class ExternalSourceInfo(object):
def getExternalIdentifier(self): def getExternalIdentifier(self):
# first try to find adapter on adapted concept or resource # first try to find adapter on adapted concept or resource
adobj = adapted(self.context) adobj = adapted(self.context)
if adobj != self.context: #if adobj != self.context:
#if not adobj is self.context:
if isinstance(adobj, AdapterBase):
adaptedSourceInfo = IExternalSourceInfo(adobj, None) adaptedSourceInfo = IExternalSourceInfo(adobj, None)
if adaptedSourceInfo is not None: if adaptedSourceInfo is not None:
return adaptedSourceInfo.externalIdentifier return adaptedSourceInfo.externalIdentifier