avoid indexing error because of corrupt files
This commit is contained in:
parent
a45bf52fe7
commit
9df059e77a
1 changed files with 9 additions and 1 deletions
10
resource.py
10
resource.py
|
@ -21,6 +21,7 @@ Definition of the Concept class.
|
|||
"""
|
||||
|
||||
from cStringIO import StringIO
|
||||
from logging import getLogger
|
||||
from persistent import Persistent
|
||||
from zope import component, schema
|
||||
from zope.app.container.btree import BTreeContainer
|
||||
|
@ -63,6 +64,8 @@ from loops import util
|
|||
from loops.versioning.util import getMaster
|
||||
from loops.view import TargetRelation
|
||||
|
||||
logger = getLogger('loops.resource')
|
||||
|
||||
_ = MessageFactory('loops')
|
||||
|
||||
|
||||
|
@ -602,7 +605,12 @@ def transformToText(obj, data=None, contentType=None):
|
|||
if rfa is None:
|
||||
if isinstance(data, unicode):
|
||||
data = data.encode('UTF-8')
|
||||
return transform(StringIO(data))
|
||||
try:
|
||||
return transform(StringIO(data))
|
||||
except:
|
||||
import traceback
|
||||
logger.warn(traceback.format_exc())
|
||||
return u''
|
||||
else:
|
||||
return transform(rfa)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue