From 59e9ab575fc72221ad1478042ad751f4d1657845 Mon Sep 17 00:00:00 2001
From: legac <renaud.legac@free.fr>
Date: Sun, 21 Dec 2014 12:46:49 +0100
Subject: [PATCH] Update get_versions.

---
 modules/plugin_dbui/helper.py | 43 +++++++++++++----------------------
 1 file changed, 16 insertions(+), 27 deletions(-)

diff --git a/modules/plugin_dbui/helper.py b/modules/plugin_dbui/helper.py
index 20546f4c..d6d13640 100644
--- a/modules/plugin_dbui/helper.py
+++ b/modules/plugin_dbui/helper.py
@@ -597,31 +597,22 @@ def get_versions():
 
     # plugin dbui
     fn = os.path.join(server_path, 'static', 'plugin_dbui', 'src', 'Dbui.js')
-
-    fi = open(fn, 'rb')
-    s = fi.read()
-    fi.close()
-
-    m = re.match("(.+    version: ')([\w._-]*)('.+)", s, re.DOTALL)
-    dbui = m.group(2)
+    with open(fn, 'rb') as fi:
+        s = fi.read()
+        m = re.match("(.+    version: ')([\w._-]*)('.+)", s, re.DOTALL)
+        dbui = m.group(2)
 
     # plugin Ext JS
     extjs = current.T('plugin not install')
-    path = os.path.join(server_path, 'static', 'plugin_extjs')
+    path = os.path.join(server_path, 'static', 'plugin_extjs_6')
     if os.path.exists(path):
-        fn = os.path.join(server_path, 'static',
-                                       'plugin_extjs',
-                                       'src',
-                                       'version',
-                                       'Version.js')
+        fn = os.path.join(path, 'version.properties')
 
-        fi = open(fn, 'rb')
-        s = fi.read()
-        fi.close()
-
-        m = re.match(r".+ version = '(\d+(\.\d+)*)',", s, re.DOTALL)
-        if m:
-            extjs = m.group(1)
+        with open(fn, 'rb') as fi:
+            s = fi.read()
+            m = re.search(r"version.release=(\d+(\.\d+)*)", s)
+            if m:
+                extjs = m.group(1)
 
     # plugin mathjax
     mathjax = current.T('plugin not install')
@@ -632,13 +623,11 @@ def get_versions():
                           'plugin_mathjax',
                           'MathJax.js')
 
-        fi = open(fn, 'rb')
-        s = fi.read()
-        fi.close()
-
-        m = re.match(r'.+MathJax.version="(\d+(\.\d+)*)";', s, re.DOTALL)
-        if m:
-            mathjax = m.group(1)
+        with open(fn, 'rb') as fi:
+            s = fi.read()
+            m = re.match(r'.+MathJax.version="(\d+(\.\d+)*)";', s, re.DOTALL)
+            if m:
+                mathjax = m.group(1)
 
     # web2py
     web2py = ''
-- 
GitLab