From bc92ff9d3cc1e4b4aadbd7728f52f2829178e699 Mon Sep 17 00:00:00 2001 From: Elrond Date: Thu, 18 Apr 2013 15:53:09 +0200 Subject: Start to use six for basestring. six allows us to smoothly get more forward compatible with py3. The idea is to change things over to use six, when/if we feel a need for it. --- mediagoblin/plugins/piwigo/tools.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mediagoblin/plugins/piwigo/tools.py') diff --git a/mediagoblin/plugins/piwigo/tools.py b/mediagoblin/plugins/piwigo/tools.py index 85d77310..4d2e985a 100644 --- a/mediagoblin/plugins/piwigo/tools.py +++ b/mediagoblin/plugins/piwigo/tools.py @@ -16,6 +16,7 @@ import logging +import six import lxml.etree as ET from werkzeug.exceptions import MethodNotAllowed @@ -43,7 +44,7 @@ class PwgNamedArray(list): def _fill_element_dict(el, data, as_attr=()): for k, v in data.iteritems(): if k in as_attr: - if not isinstance(v, basestring): + if not isinstance(v, six.string_types): v = str(v) el.set(k, v) else: @@ -57,7 +58,7 @@ def _fill_element(el, data): el.text = "1" else: el.text = "0" - elif isinstance(data, basestring): + elif isinstance(data, six.string_types): el.text = data elif isinstance(data, int): el.text = str(data) -- cgit v1.2.3