Ver código fonte

[solr] Installing solr examples gives error

Change-Id: Ifb366678230a3551f7f8deb1f8c76fbf7c72d868
(cherry picked from commit 407e7ce925f66185a8322c7a0d0804174eeae77c)
(cherry picked from commit 8af0d57ea0659c5e1a40a91713b181280b36fe5e)
Prakash Ranade 3 anos atrás
pai
commit
0dcf3941e6

+ 5 - 1
apps/search/src/search/management/commands/search_setup.py

@@ -15,6 +15,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import sys
 import logging
 
 from django.core import management
@@ -43,7 +44,10 @@ class Command(BaseCommand):
 
     if not Document2.objects.filter(type='search-dashboard', owner__username__in=SAMPLE_USER_OWNERS).exists():
       with transaction.atomic():
-        management.call_command('loaddata', 'initial_search_examples.json', verbosity=2, commit=False)
+        if sys.version_info[0] > 2:
+          management.call_command('loaddata', 'initial_search_examples.json', verbosity=2)
+        else:
+          management.call_command('loaddata', 'initial_search_examples.json', verbosity=2, commit=False)
         Document.objects.sync()
 
       Document2.objects.filter(type='search-dashboard', owner__username__in=SAMPLE_USER_OWNERS).update(parent_directory=examples_dir)