Commit 52296901 authored by Klaus Wölfel's avatar Klaus Wölfel

WOELFEL TEMP: catch NotFound when uploading a PDF

We should check if this should go to generic erp5
parent 928b2449
...@@ -7,6 +7,7 @@ To use, write your own method (probably External Method, since it is most likely ...@@ -7,6 +7,7 @@ To use, write your own method (probably External Method, since it is most likely
to use re) that would analyze text content of the doc to use re) that would analyze text content of the doc
and return a dictionary of properties. and return a dictionary of properties.
""" """
from zExceptions import NotFound
information = context.getContentInformation() information = context.getContentInformation()
result = {} result = {}
...@@ -21,7 +22,10 @@ for k, v in information.items(): ...@@ -21,7 +22,10 @@ for k, v in information.items():
else: else:
result[key] = v result[key] = v
elif key == 'author': elif key == 'author':
p = context.portal_catalog.getResultValue(title = v) try:
p = context.portal_catalog.getResultValue(title = v)
except NotFound:
p = None
if p is not None: if p is not None:
result['contributor'] = p.getRelativeUrl() result['contributor'] = p.getRelativeUrl()
elif key == 'keywords': elif key == 'keywords':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment