Skip to content
This repository has been archived by the owner on Apr 9, 2023. It is now read-only.

Commit

Permalink
Add a non indexing exception in case we need to dealthat an attribute…
Browse files Browse the repository at this point in the history
… sometimes can't be indexed
  • Loading branch information
Ramon Navarro Bosch committed Jan 8, 2017
1 parent 6a95c84 commit a88efd2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/plone.server/plone/server/catalog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,7 @@ def get_parent_uuid(ob):
if hasattr(ob, '__parent__')\
and ob.__parent__ is not None:
return ob.__parent__.uuid


class NoIndexField(Exception):
pass
12 changes: 8 additions & 4 deletions src/plone.server/plone/server/catalog/catalog.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from plone.server.catalog import NoIndexField
from plone.server.content import iter_schemata_for_type
from plone.server.directives import index
from plone.server.directives import merged_tagged_value_dict
Expand Down Expand Up @@ -100,10 +101,13 @@ def __call__(self):
for schema in iter_schemata_for_type(self.content.portal_type):
behavior = schema(self.content)
for index_name, index_data in merged_tagged_value_dict(schema, index.key).items():
if 'accessor' in index_data:
values[index_name] = index_data['accessor'](behavior)
else:
values[index_name] = self.get_data(behavior, schema, index_name)
try:
if 'accessor' in index_data:
values[index_name] = index_data['accessor'](behavior)
else:
values[index_name] = self.get_data(behavior, schema, index_name)
except NoIndexField:
pass
for metadata_name in merged_tagged_value_list(schema, metadata.key):
values[metadata_name] = self.get_data(behavior, schema, metadata_name)

Expand Down

0 comments on commit a88efd2

Please sign in to comment.