[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GMG-Devel] [PATCH 42/83] Store attributes from a model only it its avai
From: |
Alon Levy |
Subject: |
[GMG-Devel] [PATCH 42/83] Store attributes from a model only it its available. |
Date: |
Tue, 25 Feb 2014 21:58:25 +0200 |
From: Praveen Kumar <address@hidden>
---
mediagoblin/plugins/search/base.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/mediagoblin/plugins/search/base.py
b/mediagoblin/plugins/search/base.py
index aca5967..5d56faa 100644
--- a/mediagoblin/plugins/search/base.py
+++ b/mediagoblin/plugins/search/base.py
@@ -174,13 +174,15 @@ class SearchIndex(object):
attr = None
if name.endswith('_stored'):
parent_name = name.replace('_stored', '')
- attr = getattr(obj, parent_name)
+ attr = getattr(obj, parent_name, None)
else:
- attr = getattr(obj, name)
+ attr = getattr(obj, name, None)
if isinstance(attr, int):
attr = unicode(attr)
- document[name] = attr
+
+ if attr:
+ document[name] = attr
except AttributeError:
_log.info("Attribute %s not found in %s"%(
name, obj.__class__.__name__))
--
1.8.5.3
- [GMG-Devel] [PATCH 31/83] Refactor SearchIndex and add method to update an index., (continued)
- [GMG-Devel] [PATCH 31/83] Refactor SearchIndex and add method to update an index., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 32/83] Add event listener for model update, Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 33/83] Add listener for model delete event., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 34/83] Fix bugs in SearchIndex, Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 35/83] Add indices for MediaEntry and MediaTag., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 36/83] Add schema for MediaTag., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 37/83] Register schemas for MediaEntry and MediaTag., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 38/83] Add gmg command to delete all indices., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 39/83] Clean up and add docstring to search methods., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 40/83] Add try-except block to event listeners., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 42/83] Store attributes from a model only it its available.,
Alon Levy <=
- [GMG-Devel] [PATCH 43/83] Add field for storing search results., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 41/83] Correct method names in event listeners, Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 44/83] Remove the field for storing search results with the index., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 46/83] Add verbose_name and css_id to search results., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 47/83] Adapt results collection to change in result generation., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 48/83] Modify search template to show tabbed results., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 49/83] Show only unique results., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 50/83] Change element ids and some template fixes., Alon Levy, 2014/02/25
- [GMG-Devel] [PATCH 51/83] Change view function for the search page., Alon Levy, 2014/02/25