Fix unicode error for python3
Fix undefined name 'unicode' errors when python3 is used. Change-Id: I6803a1e5154c3815bd57392272630aac689f13fb Signed-off-by: Ranler Cao <caoran@fiberhome.com>
This commit is contained in:
parent
80864fb96d
commit
c747023b46
@ -20,6 +20,7 @@ A Docker Hypervisor which allows running Linux Containers instead of VMs.
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import six
|
||||
import socket
|
||||
import time
|
||||
|
||||
@ -233,7 +234,9 @@ class DockerDriver(driver.ComputeDriver):
|
||||
self._stop_firewall(instance, network_info)
|
||||
|
||||
def _encode_utf8(self, value):
|
||||
return unicode(value).encode('utf-8')
|
||||
if six.PY2 and not isinstance(value, unicode):
|
||||
value = unicode(value)
|
||||
return value.encode('utf-8')
|
||||
|
||||
def _find_container_by_instance(self, instance):
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user