Revision df455d57

b/snf-cyclades-app/synnefo/logic/utils.py
33 33
from snf_django.lib.api import faults
34 34
from django.conf import settings
35 35
from copy import deepcopy
36
from synnefo.util.text import uenc
36
from django.utils.encoding import smart_unicode
37 37

  
38 38

  
39 39
def id_from_instance_name(name):
......
193 193

  
194 194
def check_name_length(name, max_length, message):
195 195
    """Check if a string is within acceptable value length"""
196
    if len(uenc(name)) > max_length:
196
    name = smart_unicode(name, encoding="utf-8")
197
    if len(name) > max_length:
197 198
        raise faults.BadRequest(message)
b/snf-cyclades-app/synnefo/plankton/backend.py
62 62

  
63 63
from django.conf import settings
64 64
from django.utils import importlib
65
from django.utils.encoding import smart_unicode
65 66
from pithos.backends.base import NotAllowedError, VersionNotExists
66
from synnefo.util.text import uenc
67 67

  
68 68

  
69 69
logger = logging.getLogger(__name__)
......
211 211
        """Update object's metadata."""
212 212
        account, container, name = split_url(image_url)
213 213

  
214
        prefixed = [(PLANKTON_PREFIX + uenc(k), uenc(v))
214
        prefixed = [(PLANKTON_PREFIX + smart_unicode(k, encoding="utf-8"),
215
                     smart_unicode(v, encoding="utf-8"))
215 216
                    for k, v in meta.items()
216 217
                    if k in PLANKTON_META or k.startswith(PROPERTY_PREFIX)]
217 218
        prefixed = dict(prefixed)
b/snf-cyclades-app/synnefo/plankton/views.py
39 39

  
40 40
from django.conf import settings
41 41
from django.http import HttpResponse
42
from django.utils.encoding import smart_unicode
42 43

  
43 44
from snf_django.lib import api
44 45
from snf_django.lib.api import faults
45
from synnefo.util.text import uenc
46 46
from synnefo.plankton.utils import image_backend
47 47
from synnefo.plankton.backend import split_url, InvalidLocation
48 48

  
......
87 87
        if key == 'properties':
88 88
            for k, v in image.get('properties', {}).items():
89 89
                name = 'x-image-meta-property-' + k.replace('_', '-')
90
                response[name] = uenc(v)
90
                response[name] = smart_unicode(v, encoding="utf-8")
91 91
        else:
92 92
            name = 'x-image-meta-' + key.replace('_', '-')
93
            response[name] = uenc(image.get(key, ''))
93
            response[name] = smart_unicode(image.get(key, ''), encoding="utf-8")
94 94

  
95 95
    return response
96 96

  
......
152 152
    name = params.pop('name')
153 153
    if name is None:
154 154
        raise faults.BadRequest("Image 'name' parameter is required")
155
    elif len(uenc(name)) == 0:
155
    elif len(smart_unicode(name, encoding="utf-8")) == 0:
156 156
        raise faults.BadRequest("Invalid image name")
157 157
    location = params.pop('location', None)
158 158
    if location is None:

Also available in: Unified diff