From 6c4f5846c8e21d6e48347b7e661edb72ffabb9f1 Mon Sep 17 00:00:00 2001 From: nkryptic Date: Tue, 12 Mar 2013 01:08:59 -0400 Subject: Add full Python 3 compatibility (Closes #10, #20, #49). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also: - update travis.yml to build against 2.6-2.7 and 3.2-3.3 - Switch to relative imports Signed-off-by: Raphaƫl Barrois --- factory/declarations.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'factory/declarations.py') diff --git a/factory/declarations.py b/factory/declarations.py index b491bfb..2b1fc05 100644 --- a/factory/declarations.py +++ b/factory/declarations.py @@ -25,7 +25,8 @@ import collections import itertools import warnings -from factory import utils +from . import compat +from . import utils class OrderedDeclaration(object): @@ -294,7 +295,7 @@ class SubFactory(ParameteredAttribute): self.factory_module = self.factory_name = '' else: # Must be a string - if not isinstance(factory, basestring) or '.' not in factory: + if not isinstance(factory, compat.string_types) or '.' not in factory: raise ValueError( "The argument of a SubFactory must be either a class " "or the fully qualified path to a Factory class; got " @@ -393,7 +394,7 @@ class RelatedFactory(PostGenerationDeclaration): self.factory_module = self.factory_name = '' else: # Must be a string - if not isinstance(factory, basestring) or '.' not in factory: + if not isinstance(factory, compat.string_types) or '.' not in factory: raise ValueError( "The argument of a SubFactory must be either a class " "or the fully qualified path to a Factory class; got " -- cgit v1.2.3