fix overrides.zcml: set skin; fix resource indexing: avoid error when principal not found
This commit is contained in:
parent
76e189ac45
commit
2a689a871b
3 changed files with 11 additions and 5 deletions
|
@ -84,8 +84,9 @@ def getInternalPrincipal(id, context=None, pau=None):
|
||||||
raise PrincipalLookupError(id)
|
raise PrincipalLookupError(id)
|
||||||
|
|
||||||
|
|
||||||
def getPrincipalForUserId(id, context=None):
|
def getPrincipalForUserId(id, context=None, auth=None):
|
||||||
auth = component.getUtility(IAuthentication, context=context)
|
if auth is None:
|
||||||
|
auth = component.getUtility(IAuthentication, context=context)
|
||||||
try:
|
try:
|
||||||
return auth.getPrincipal(id)
|
return auth.getPrincipal(id)
|
||||||
except PrincipalLookupError:
|
except PrincipalLookupError:
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
<!-- ZCML declarations to override the default definitions -->
|
<!-- ZCML declarations to override the default definitions -->
|
||||||
|
|
||||||
|
<browser:defaultSkin name="Loops" />
|
||||||
|
|
||||||
<browser:containerViews
|
<browser:containerViews
|
||||||
for="zope.app.folder.interfaces.IFolder"
|
for="zope.app.folder.interfaces.IFolder"
|
||||||
contents="zope.ManageContent"
|
contents="zope.ManageContent"
|
||||||
|
|
|
@ -588,12 +588,15 @@ class IndexAttributes(object):
|
||||||
self.creators()).strip()
|
self.creators()).strip()
|
||||||
|
|
||||||
def creators(self):
|
def creators(self):
|
||||||
|
from loops.organize.util import getPrincipalForUserId
|
||||||
cr = IZopeDublinCore(self.context).creators or []
|
cr = IZopeDublinCore(self.context).creators or []
|
||||||
pau = component.getUtility(IAuthentication)
|
pau = component.getUtility(IAuthentication, context=self.context)
|
||||||
creators = []
|
creators = []
|
||||||
for c in cr:
|
for c in cr:
|
||||||
principal = pau.getPrincipal(c)
|
principal = getPrincipalForUserId(c, auth=pau)
|
||||||
if principal is not None:
|
if principal is None:
|
||||||
|
creators.append(c)
|
||||||
|
else:
|
||||||
creators.append(principal.title)
|
creators.append(principal.title)
|
||||||
return creators
|
return creators
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue