From 5fae100c698ded37db412c405631ac831ef35572 Mon Sep 17 00:00:00 2001
From: Gary Williams <gary.williams@forgerock.com>
Date: Tue, 22 Nov 2011 15:52:14 +0000
Subject: [PATCH] Maintain backwards compatability with older version of Jython on Unicode

---
 opends/tests/staf-tests/shared/python/common.py |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/opends/tests/staf-tests/shared/python/common.py b/opends/tests/staf-tests/shared/python/common.py
index 7f46f4e..2c3299d 100644
--- a/opends/tests/staf-tests/shared/python/common.py
+++ b/opends/tests/staf-tests/shared/python/common.py
@@ -55,7 +55,8 @@
             "list_matches" ,
             "count_attr" ,
             "host_is_localhost" ,
-            "md5_hash"
+            "md5_hash" ,
+            "value_not_string"
             ]
 
 class format_testcase:
@@ -856,3 +857,22 @@
     import md5
     m = md5.new()
   return m
+  
+def value_not_string(value):
+  from org.python.core import PyString,PyList,PyDictionary
+  try:
+    from org.python.core import PyUnicode
+  except ImportError:
+    # Unicode is NOT supported in this version of Jython
+    print "WARNING: Jython version does not support Unicode."
+    if value.__class__ is not PyString:
+      return 1
+    else:
+      return 0
+
+  # Unicode is supported in this version of Jython  
+  if value.__class__ is not PyString and value.__class__ is not PyUnicode:
+    return 1
+  else:
+    return 0
+

--
Gitblit v1.10.0