Check for PyAMS command line script in application startup
authorThierry Florac <tflorac@ulthar.net>
Sun, 18 Feb 2018 12:45:07 +0100
changeset 48 4575175f6458
parent 47 92e1d7b3022e
child 49 78867d93d490
Check for PyAMS command line script in application startup
src/pyams_content_es/include.py
--- a/src/pyams_content_es/include.py	Sun Feb 18 12:44:23 2018 +0100
+++ b/src/pyams_content_es/include.py	Sun Feb 18 12:45:07 2018 +0100
@@ -18,6 +18,7 @@
 import logging
 logger = logging.getLogger('PyAMS (content.es)')
 
+import os.path
 import sys
 
 # import interfaces
@@ -51,8 +52,9 @@
 def handle_new_application(event):
     """Start indexer process when application created"""
 
-    # check for upgrade mode
-    if sys.argv[0].endswith('pyams_upgrade'):
+    # check for PyAMS command line script
+    cmdline = os.path.split(sys.argv[0])[-1]
+    if cmdline.startswith('pyams_'):
         return
 
     registry = get_global_registry()