[buildobjs] deal with py3k's string types

Related to #267910.

authorJulien Cristau <julien.cristau@logilab.fr>
changeset57ee237b1f48
branchdefault
phasedraft
hiddenyes
parent revision#b530a2aa8c99 [exceptions] don't define __str__ in terms of unicode on py3k
child revision#cfeafb5bf690 [constraints] deal with py3k's string types
files modified by this revision
buildobjs.py
# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1413451661 -7200
# Thu Oct 16 11:27:41 2014 +0200
# Node ID 57ee237b1f48b0d1a35bf63ec5f3dc17c603450f
# Parent b530a2aa8c996f45235a2677845ef86ddb669407
[buildobjs] deal with py3k's string types

Related to #267910.

diff --git a/buildobjs.py b/buildobjs.py
@@ -20,11 +20,11 @@
1  __docformat__ = "restructuredtext en"
2 
3  from warnings import warn
4  from copy import copy
5 
6 -from six import add_metaclass
7 +from six import add_metaclass, string_types
8 
9  from logilab.common import attrdict
10  from logilab.common.decorators import iclassmethod
11 
12  from yams import (BASE_TYPES, MARKER, BadSchemaDefinition, KNOWN_METAATTRIBUTES,
@@ -758,11 +758,11 @@
13  def _actual_types(schema, etype):
14      if etype == '*':
15          return _pow_etypes(schema)
16      if isinstance(etype, (list, tuple)):
17          return etype
18 -    if not isinstance(etype, basestring):
19 +    if not isinstance(etype, string_types):
20          raise RuntimeError('Entity types must not be instances but strings '
21                             'or list/tuples thereof. Ex. (bad, good) : '
22                             'SubjectRelation(Foo), SubjectRelation("Foo"). '
23                             'Hence, %r is not acceptable.' % etype)
24      return (etype,)