Skip to content

Commit

Permalink
fix adder where binary is not a blob (test)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgross committed Sep 25, 2016
1 parent 49fc70c commit cc3e044
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/collective/solr/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ def getblob(self):

def getpath(self):
blob = self.getblob()
if blob is None:
return None
try:
path = blob.committed()
except BlobError:
Expand All @@ -130,6 +132,9 @@ def getpath(self):

def __call__(self, conn, **data):
postdata = {}
path = self.getpath()
if path is None:
super(BinaryAdder, self).__call__(conn, **data)
postdata['stream.file'] = self.getpath()
postdata['stream.contentType'] = data.get(
'content_type',
Expand All @@ -156,7 +161,7 @@ class DXFileBinaryAdder(BinaryAdder):

def getblob(self):
field = getattr(self.context, self.fieldname, None)
return field._blob
return getattr(field, '_blob', None)


class DXImageBinaryAdder(DXFileBinaryAdder):
Expand Down

0 comments on commit cc3e044

Please sign in to comment.