2424natural_number_validator = get_validator ('natural_number_validator' )
2525configured_default = get_validator ('configured_default' )
2626limit_to_configured_maximum = get_validator ('limit_to_configured_maximum' )
27+ unicode_safe = get_validator ('unicode_safe' )
2728
2829
2930def rename (old , new ):
@@ -103,12 +104,12 @@ def unicode_or_json_validator(value, context):
103104
104105def datastore_create_schema ():
105106 schema = {
106- 'resource_id' : [ignore_missing , text_type , resource_id_exists ],
107+ 'resource_id' : [ignore_missing , unicode_safe , resource_id_exists ],
107108 'force' : [ignore_missing , boolean_validator ],
108109 'id' : [ignore_missing ],
109110 'aliases' : [ignore_missing , list_of_strings_or_string ],
110111 'fields' : {
111- 'id' : [not_empty , text_type ],
112+ 'id' : [not_empty , unicode_safe ],
112113 'type' : [ignore_missing ],
113114 'info' : [ignore_missing ],
114115 },
@@ -135,10 +136,10 @@ def datastore_create_schema():
135136
136137def datastore_upsert_schema ():
137138 schema = {
138- 'resource_id' : [not_missing , not_empty , text_type ],
139+ 'resource_id' : [not_missing , not_empty , unicode_safe ],
139140 'force' : [ignore_missing , boolean_validator ],
140141 'id' : [ignore_missing ],
141- 'method' : [ignore_missing , text_type , one_of (
142+ 'method' : [ignore_missing , unicode_safe , one_of (
142143 ['upsert' , 'insert' , 'update' ])],
143144 'calculate_record_count' : [ignore_missing , default (False ),
144145 boolean_validator ],
@@ -151,7 +152,7 @@ def datastore_upsert_schema():
151152
152153def datastore_delete_schema ():
153154 schema = {
154- 'resource_id' : [not_missing , not_empty , text_type ],
155+ 'resource_id' : [not_missing , not_empty , unicode_safe ],
155156 'force' : [ignore_missing , boolean_validator ],
156157 'id' : [ignore_missing ],
157158 'calculate_record_count' : [ignore_missing , default (False ),
@@ -164,12 +165,12 @@ def datastore_delete_schema():
164165
165166def datastore_search_schema ():
166167 schema = {
167- 'resource_id' : [not_missing , not_empty , text_type ],
168+ 'resource_id' : [not_missing , not_empty , unicode_safe ],
168169 'id' : [ignore_missing ],
169170 'q' : [ignore_missing , unicode_or_json_validator ],
170171 'plain' : [ignore_missing , boolean_validator ],
171172 'filters' : [ignore_missing , json_validator ],
172- 'language' : [ignore_missing , text_type ],
173+ 'language' : [ignore_missing , unicode_safe ],
173174 'limit' : [
174175 configured_default ('ckan.datastore.search.rows_default' , 100 ),
175176 natural_number_validator ,
@@ -213,5 +214,5 @@ def datastore_function_delete_schema():
213214
214215def datastore_analyze_schema ():
215216 return {
216- 'resource_id' : [text_type , resource_id_exists ],
217+ 'resource_id' : [unicode_safe , resource_id_exists ],
217218 }
0 commit comments