Murano py27和py34的兼容处理
tox.ini
envlist = py27,py34,pep8
1. django.utils.encoding.force_unicode替换成django.utils.encoding.force_text
from django.utils.encoding import force_unicode
修改成:
from django.utils.encoding import force_text
unicode(kwargs[arg])
修改成:
force_text(kwargs[arg])
2. iteritems替换成six.iteritems
for key, value in kwargs.iteritems():
修改成
for key, value in six.iteritems(kwargs):
iter(self.__dict__.itervalues())
修改成
iter(six.itervalues(self.__dict__))
3.import types替换成import six
types.DictType
修改成
dict
types.ListType
修改成
list
types.TupleType
修改成
tuple
basestring
修改成
six.string_types
Refer: https://blueprints.launchpad.net/murano/+spec/murano-python-3-support