Skip to content

Commit

Permalink
[#1841] extras_unicode_convert is not a validator
Browse files Browse the repository at this point in the history
  • Loading branch information
wardi committed Aug 7, 2014
1 parent 683c7ff commit 3770777
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 5 additions & 0 deletions ckan/logic/converters.py
Expand Up @@ -34,6 +34,11 @@ def remove_from_extras(data, key):
return
remove_from_extras(data, data_key[1])

def extras_unicode_convert(extras, context):
for extra in extras:
extras[extra] = unicode(extras[extra])
return extras

def date_to_db(value, context):
try:
value = field_types.DateType.form_to_db(value)
Expand Down
2 changes: 1 addition & 1 deletion ckan/logic/schema.py
Expand Up @@ -10,7 +10,6 @@
from ckan.logic.validators import (package_id_not_changed,
package_id_exists,
package_id_or_name_exists,
extras_unicode_convert,
name_validator,
package_name_validator,
package_version_validator,
Expand Down Expand Up @@ -60,6 +59,7 @@
convert_group_name_or_id_to_id,
convert_to_json_if_string,
remove_whitespace,
extras_unicode_convert,
)
from formencode.validators import OneOf
import ckan.model
Expand Down
5 changes: 0 additions & 5 deletions ckan/logic/validators.py
Expand Up @@ -307,11 +307,6 @@ def object_id_validator(key, activity_dict, errors, context):
raise Invalid('There is no object_id validator for '
'activity type "%s"' % activity_type)

def extras_unicode_convert(extras, context):
for extra in extras:
extras[extra] = unicode(extras[extra])
return extras

name_match = re.compile('[a-z0-9_\-]*$')
def name_validator(value, context):
'''Return the given value if it's a valid name, otherwise raise Invalid.
Expand Down

0 comments on commit 3770777

Please sign in to comment.