[buildobjs] deal with py3k's string types

Related to #267910.

authorJulien Cristau <julien.cristau@logilab.fr>
changeset32c4bc375ae0
branchdefault
phasepublic
hiddenno
parent revision#704215d49a58 [exceptions] don't define __str__ in terms of unicode on py3k
child revision#88c2c8b7373d [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 32c4bc375ae09edb7b32d5f8661a7df1cb214dba
# Parent 704215d49a5800314a77e82239cc74ddbe6745eb
[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,)