From a15b1a55412f812fff8c0d599c9fe704555f44c7 Mon Sep 17 00:00:00 2001
From: legac <renaud.legac@free.fr>
Date: Thu, 28 Mar 2013 21:36:26 +0100
Subject: [PATCH] More robust version of the helper function get_version

---
 modules/plugin_dbui/helper.py | 12 +++++++++---
 static/plugin_dbui/CHANGELOG  |  3 ++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/modules/plugin_dbui/helper.py b/modules/plugin_dbui/helper.py
index c9c16315..2ee622b7 100644
--- a/modules/plugin_dbui/helper.py
+++ b/modules/plugin_dbui/helper.py
@@ -441,10 +441,16 @@ def get_versions():
 
     # web2py
     web2py = ''
-    m = re.match('\d+\.\d+\.\d+', current.request.env.web2py_version)
-    if m:
-        web2py = m.group()
+    val = current.request.env.web2py_version
+    if isinstance(val, str):
+        m = re.match('\d+\.\d+\.\d+', val)
+        if m:
+            web2py = m.group()
 
+    elif isinstance(val, (tuple, list)):
+        li = [str(el) for el in val if isinstance(el, int)]
+        web2py = '.'.join(li)
+        
     # version of the application
     myapp = current.T("unknown")
     
diff --git a/static/plugin_dbui/CHANGELOG b/static/plugin_dbui/CHANGELOG
index 27618a4e..35687833 100644
--- a/static/plugin_dbui/CHANGELOG
+++ b/static/plugin_dbui/CHANGELOG
@@ -1,7 +1,8 @@
 --------------------------------- CHANGE LOG ----------------------------------
 
 HEAD
-
+  - More robst version of the helper function get_version.
+  
 0.4.11.1 (Mar 2013)
   - Deploy the javascript statement "use strict" (JSLINT)
   - Upgrade to run with alias table.
-- 
GitLab