Index: /branches/amp_4_0/platform/config/init_db.sql
===================================================================
--- /branches/amp_4_0/platform/config/init_db.sql	(revision 2658)
+++ /branches/amp_4_0/platform/config/init_db.sql	(working copy)
@@ -417,6 +417,6 @@
     end_time TIMESTAMP DEFAULT NULL,
     status integer DEFAULT 0,
     result TEXT DEFAULT NULL,
-    FOREIGN KEY (report_id) REFERENCES REPORT(id) ON DELETE CASCADE,
+    FOREIGN KEY (report_id) REFERENCES REPORT(id) ON DELETE CASCADE
 );
 -- psql -U amp_admin -d cm -f /path/to/your/init_db.sql
Index: /branches/amp_4_0/src/webui/webui/htdocs/new/src/cm/urls.py
===================================================================
--- /branches/amp_4_0/src/webui/webui/htdocs/new/src/cm/urls.py	(revision 2658)
+++ /branches/amp_4_0/src/webui/webui/htdocs/new/src/cm/urls.py	(working copy)
@@ -2,8 +2,7 @@
 
 from cm.router import *
 
-app_urlpatterns = ['',
-                   re_path(r'^cm/configuration/device/get_schedule_backup_all$', fetch_schedule_backup_all),
+app_urlpatterns = [re_path(r'^cm/configuration/device/get_schedule_backup_all$', fetch_schedule_backup_all),
                    re_path(r'^cm/configuration/device/clear_schedule_backup_all$', clear_schedule_backup_all),
                    re_path(r'^cm/configuration/configuration_file/(?P<params>.*)$', get_configuration),
                    re_path(r'^cm/va_mgmt/vnc_host_info$', vnc_host_info),
Index: /branches/amp_4_0/src/webui/webui/htdocs/new/src/djproject/settings.py
===================================================================
--- /branches/amp_4_0/src/webui/webui/htdocs/new/src/djproject/settings.py	(revision 2658)
+++ /branches/amp_4_0/src/webui/webui/htdocs/new/src/djproject/settings.py	(working copy)
@@ -92,7 +92,7 @@
     #     'django.template.loaders.eggs.Loader',
 )
 
-MIDDLEWARE_CLASSES = (
+MIDDLEWARE = (
     'django.middleware.common.CommonMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
@@ -194,7 +194,7 @@
             'level': 'DEBUG',
             'class': 'logging.handlers.RotatingFileHandler',
             'filename': '/var/log/hive.log',
-            'maxBytes': 1024 * 1024 * 50,  # 50 MB
+            'maxBytes': 1024 * 1024 * 50,  # 50 MBDEBUG
             'backupCount': 2,
             'formatter': 'standard',
         },
Index: /branches/amp_4_0/src/webui/webui/htdocs/new/src/hive/model/legacycli.py
===================================================================
--- /branches/amp_4_0/src/webui/webui/htdocs/new/src/hive/model/legacycli.py	(revision 2658)
+++ /branches/amp_4_0/src/webui/webui/htdocs/new/src/hive/model/legacycli.py	(working copy)
@@ -6,6 +6,7 @@
 import time
 from collections import OrderedDict
 from filecmp import cmp
+import traceback
 
 from django.conf import settings
 
@@ -115,10 +116,10 @@
 MODE_CONFIG = CLIMode('CONFIG', 2)
 MODE_ENGINEER = CLIMode('ENGINEER', 3)
 
-F_EOU = '\xFD'
-F_EOP = '\xFC'
-F_EOC = '\xFB'
-F_EOS = '\xFA'
+F_EOU = b'\xFD'
+F_EOP = b'\xFC'
+F_EOC = b'\xFB'
+F_EOS = b'\xFA'
 
 # This line is just for loading the settings
 xxx = settings.INSTALLED_APPS
@@ -317,6 +318,7 @@
 
         :returns: The result of the parsing workflow. If no parser args, the command output is directly returned.
         """
+        andebug('an.model.cli', 'cmd function call trace:\n{}'.format(''.join(traceback.format_stack())))
         if FAST_CLI_CMD and getattr(_thread_locals, '_is_set_enable', False):
             return self.cmd_direct(cmd, *args)
         if not cmd[-1] == '\n':
@@ -337,13 +339,19 @@
 
         cmd_str = cmd.encode('utf-8')
         while len(cmd_str) > 0:
-            each_cmd = cmd_str[:cmd_len] + F_EOC + self._username.encode('utf-8') + F_EOU + session_id.encode(
-                'utf-8') + F_EOS
+            each_cmd = (
+                    cmd_str[:cmd_len] +
+                    F_EOC +
+                    self._username.encode('utf-8') +
+                    F_EOU +
+                    session_id.encode('utf-8') +
+                    F_EOS
+            )
             self._send(each_cmd)
             if len(cmd_str) > cmd_len:
                 cmd_str = cmd_str[cmd_len:]
             else:
-                cmd_str = ''
+                cmd_str = b''
 
         output = self._receive(F_EOP)
         andebug('an.model.cli', 'cli command execution: "%s", output: "%s"' % (cmd, output))
Index: /branches/amp_4_0/src/webui/webui/htdocs/new/src/hive/session.py
===================================================================
--- /branches/amp_4_0/src/webui/webui/htdocs/new/src/hive/session.py	(revision 2658)
+++ /branches/amp_4_0/src/webui/webui/htdocs/new/src/hive/session.py	(working copy)
@@ -431,7 +431,18 @@
 class HiveSessionMiddleware(object):
     global_thread_id = 1
 
-    def process_request(self, request):
+    def __init__(self, get_response):
+        self.get_response = get_response
+
+    def __call__(self, request):
+        response = self._process_request(request)
+        if response is not None:
+            return response
+
+        response = self.get_response(request)
+        return response
+
+    def _process_request(self, request):
         if getattr(_thread_locals, '_hive_thread_id', -1) == -1:
             _thread_locals._hive_thread_id = HiveSessionMiddleware.global_thread_id
             HiveSessionMiddleware.global_thread_id += 1
Index: /branches/amp_4_0/src/webui/webui/htdocs/new/src/hive/shared.py
===================================================================
--- /branches/amp_4_0/src/webui/webui/htdocs/new/src/hive/shared.py	(revision 2658)
+++ /branches/amp_4_0/src/webui/webui/htdocs/new/src/hive/shared.py	(working copy)
@@ -33,7 +33,7 @@
     return HttpResponse(template.render(ctx))
 
 
-def custom_500_view(request, exception):
+def custom_500_view(request):
     sess = get_current_session()
     django_ctx = RequestContext(request)
     env = HiveEnvironment(loader=ChoiceLoader([PackageLoader('hive', 'templates')]))
Index: /branches/amp_4_0/src/webui/webui/htdocs/new/src/lib/yaml/__init__.py
===================================================================
--- /branches/amp_4_0/src/webui/webui/htdocs/new/src/lib/yaml/__init__.py	(revision 2658)
+++ /branches/amp_4_0/src/webui/webui/htdocs/new/src/lib/yaml/__init__.py	(working copy)
@@ -1,11 +1,11 @@
-from error import *
+from .error import *
 
-from tokens import *
-from events import *
-from nodes import *
+from .tokens import *
+from .events import *
+from .nodes import *
 
-from loader import *
-from dumper import *
+from .loader import *
+from .dumper import *
 
 __version__ = '5.3.1'
 
\ No newline at end of file
Index: /branches/amp_4_0/tools/requirements.txt
===================================================================
--- /branches/amp_4_0/tools/requirements.txt	(revision 2658)
+++ /branches/amp_4_0/tools/requirements.txt	(working copy)
@@ -1,45 +1,92 @@
+anyio==4.9.0
 APScheduler==3.3.1
+asgiref==3.8.1
 backports.ssl-match-hostname==3.5.0.1
 configobj==4.7.2
+certifi==2025.4.26
+chardet==5.2.0
+charset-normalizer==3.4.2
 decorator==3.4.0
-Django==1.5.12
+dicttoxml==1.7.16
+Django==5.2.1
+django-callback==0.6.1
 django-revproxy==0.10.0
+dnspython==2.7.0
+dynuipv4update==0.12
 elasticsearch==6.0.0
+elastic-transport==8.17.1
 flup==1.0.2
 funcsigs==1.0.2
 futures==3.1.1
+getpublicipv4==0.12
+h11==0.16.0
+httpcore==1.0.9
+httpx==0.28.1
+idna==3.10
 influxdb==5.3.1
+influxdb-client==1.49.0
 iniparse==0.4
 ipaddress==1.0.16
 javapackages==1.0.0
 Jinja2==2.7.2
+joblib==1.5.0
+kthread==0.2.3
+kthread-sleep==0.11
 lxml==3.2.1
 M2Crypto==0.25.1
-MarkupSafe==0.11
+MarkupSafe==3.0.2
 msgpack==1.0.4
+numpy==2.2.6
+ordered-set==4.1.0
 perf==0.1
 Pillow==4.0.0
+pfehler==0.10
+pillow==11.2.1
+prettytable==3.16.0
 psutil==5.0.0
 psycopg2==2.7.5
+psycopg2-binary==2.9.10
+pyasynchat==1.0.4
+pyasyncore==1.0.4
 pycurl==7.19.0
+pyecharts==2.0.8
 pyftpdlib==1.5.2
 pygobject==3.22.0
 pygpgme==0.3
+PyLaTeX==1.4.2
+pymongo==4.13.2
 pyliblzma==0.5.3
 python-linux-procfs==0.4.9
+python-dateutil==2.9.0.post0
 pytz==2017.2
 pyudev==0.15
 pyxattr==0.5.1
-reportlab==3.4.0
-requests==2.13.0
+reactivex==4.0.4
+reportlab==4.4.1
+requests==2.32.3
+revproxy==0.12
+rpm==0.4.0
+scikit-learn==1.6.1
+scipy==1.15.3
 schedule==0.6.0
 schedutils==0.4
-six==1.10.0
+setuptools==80.9.0
+simplejson==3.20.1
+six==1.17.0
 slip==0.4.0
 slip.dbus==0.4.0
+sniffio==1.3.1
+sqlparse==0.5.3
+stderrstdoutcapture==0.10
+thread==2.0.5
+threadpoolctl==3.6.0
+touchtouch==0.11
 tftpy==0.6.2
+typing_extensions==4.13.2
 tzlocal==1.4
 urlgrabber==3.10
 urllib3==1.22
+Wand==0.6.13
+wcwidth==0.2.13
 Whoosh==2.7.4
 yum-metadata-parser==1.1.4
