diff --git a/cgi-bin/core/doctype/sandbox/sandbox.txt b/cgi-bin/core/doctype/sandbox/sandbox.txt index cae1065f59..c0dd5a3a94 100644 --- a/cgi-bin/core/doctype/sandbox/sandbox.txt +++ b/cgi-bin/core/doctype/sandbox/sandbox.txt @@ -76,7 +76,18 @@ 'fieldname': 'test_link', 'fieldtype': 'Link', 'idx': 2, - 'label': 'Test Link' + 'label': 'Test Link', + 'options': 'Profile' + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'test_select', + 'fieldtype': 'Select', + 'idx': 2, + 'label': 'Test Select', + 'options': 'A\nB\nC' }, # DocField diff --git a/cgi-bin/webnotes/__init__.py b/cgi-bin/webnotes/__init__.py index 6b77d0c7d3..06833e2e77 100644 --- a/cgi-bin/webnotes/__init__.py +++ b/cgi-bin/webnotes/__init__.py @@ -57,6 +57,8 @@ cookies = {} auto_masters = {} tenant_id = None +from webnotes.utils import cstr + # # Custom Class (no traceback) # @@ -90,13 +92,13 @@ def errprint(msg): """ Append to the :data:`debug log` """ - debug_log.append(str(msg or '')) + debug_log.append(cstr(msg or '')) def msgprint(msg, small=0, raise_exception=0): """ Append to the :data:`message_log` """ - message_log.append((small and '__small:' or '')+str(msg or '')) + message_log.append((small and '__small:' or '')+cstr(msg or '')) if raise_exception: raise ValidationError diff --git a/cgi-bin/webnotes/utils/__init__.py b/cgi-bin/webnotes/utils/__init__.py index e770963a7c..5ee963863f 100644 --- a/cgi-bin/webnotes/utils/__init__.py +++ b/cgi-bin/webnotes/utils/__init__.py @@ -295,7 +295,7 @@ def cstr(s): s = s.encode('utf-8', 'ignore') except: pass - return str(s) + return unicode(s) def str_esc_quote(s): """