-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Attached is a patch to fix this problem using isinstance in the three
places that I have seen this cause problems.
- --
Scott Henson
Red Hat CIS Operator
WVU Alum BSAE/BSME
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora -
http://enigmail.mozdev.org
iEYEARECAAYFAknNGqUACgkQZ+CEIfzQ+EoefACggBwZ2QULdCw0Fafs18+2X95J
9oIAn1pmamT+RGMvIz/yD8ghgU/v2kA4
=Xr/i
-----END PGP SIGNATURE-----
From 962fcc5937e824faaf7a1b3f39fda9d409e6cae1 Mon Sep 17 00:00:00 2001
From: Scott Henson <shenson(a)redhat.com>
Date: Fri, 27 Mar 2009 14:26:37 -0400
Subject: [PATCH] Switch to using isinstance to determine if an input is a string
---
cobbler/item.py | 4 ++--
cobbler/item_system.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/cobbler/item.py b/cobbler/item.py
index fc3a914..2493c45 100644
--- a/cobbler/item.py
+++ b/cobbler/item.py
@@ -122,7 +122,7 @@ class Item(serializable.Serializable):
"""
if self.name not in ["",None] and self.parent not in
["",None] and self.name == self.parent:
raise CX(_("self parentage is weird"))
- if type(name) != type(""):
+ if isinstance(name, basestring):
raise CX(_("name must be a string"))
for x in name:
if not x.isalnum() and not x in [ "_", "-",
".", ":", "+" ] :
@@ -297,7 +297,7 @@ class Item(serializable.Serializable):
def __find_compare(self, from_search, from_obj):
- if type(from_obj) == type(""):
+ if isinstance(from_obj, basestring):
# FIXME: fnmatch is only used for string to string comparisions
# which should cover most major usage, if not, this deserves fixing
if fnmatch.fnmatch(from_obj.lower(), from_search.lower()):
diff --git a/cobbler/item_system.py b/cobbler/item_system.py
index b7e7744..999b6d4 100644
--- a/cobbler/item_system.py
+++ b/cobbler/item_system.py
@@ -317,7 +317,7 @@ class System(item.Item):
if self.name not in ["",None] and self.parent not in
["",None] and self.name == self.parent:
raise CX(_("self parentage is weird"))
- if type(name) != type(""):
+ if isinstance(name, basestring):
raise CX(_("name must be a string"))
for x in name:
if not x.isalnum() and not x in [ "_", "-",
".", ":", "+" ] :
--
1.6.0.6