From: Brian Dolbec Date: Sat, 16 Nov 2013 20:00:27 +0000 (-0800) Subject: fix attribute error for newer pythons X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e28107578761c7bf719742ce54442ff5d0914b21;p=gentoo-keys.git fix attribute error for newer pythons --- diff --git a/gkeys/utils.py b/gkeys/utils.py index 0cbcdea..b1fb69b 100644 --- a/gkeys/utils.py +++ b/gkeys/utils.py @@ -22,11 +22,18 @@ Utility functions''' -import types, re, os +import types +import re +import os import sys import locale import codecs +try: + StringTypes = types.StringTypes +except AttributeError: + StringTypes = [str] + def encoder(text, _encoding_): return codecs.encode(text, _encoding_, 'replace') @@ -132,7 +139,7 @@ def path(path_elements): ''' pathname = '' - if type(path_elements) in types.StringTypes: + if type(path_elements) in StringTypes: path_elements = [path_elements] # Concatenate elements and seperate with /