Commit 287a3f5db24607b9bd170e26f3a103fe0b5236b6

Authored by Luan
1 parent 348c1525

Checking if data was extract from file b4 sending to template

src/accounts/views.py
@@ -56,7 +56,6 @@ class UserProfileDetailView(UserProfileBaseMixin, DetailView): @@ -56,7 +56,6 @@ class UserProfileDetailView(UserProfileBaseMixin, DetailView):
56 56
57 fields_or_lookup = ( 57 fields_or_lookup = (
58 {'collaborators__contains': user.username}, 58 {'collaborators__contains': user.username},
59 - {'description__contains': user.username},  
60 {'author': user.username}, 59 {'author': user.username},
61 ) 60 )
62 61
src/proxy/search_indexes.py
@@ -50,9 +50,13 @@ class AttachmentIndex(BaseIndex, indexes.Indexable): @@ -50,9 +50,13 @@ class AttachmentIndex(BaseIndex, indexes.Indexable):
50 logger.warning(u'IOError: %s - %s', e.strerror, e.filename) 50 logger.warning(u'IOError: %s - %s', e.strerror, e.filename)
51 return data 51 return data
52 backend = self._get_backend(None) 52 backend = self._get_backend(None)
  53 +
53 extracted_data = backend.extract_file_contents(file_obj) 54 extracted_data = backend.extract_file_contents(file_obj)
54 file_obj.close() 55 file_obj.close()
55 56
  57 + if not extracted_data:
  58 + return data
  59 +
56 t = loader.select_template( 60 t = loader.select_template(
57 ('search/indexes/proxy/attachment_text.txt', ) 61 ('search/indexes/proxy/attachment_text.txt', )
58 ) 62 )