checking attribute existance before referencing it

git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@478 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
frankmorgner
2011-08-02 13:55:29 +00:00
parent 9022092c18
commit 1144b8de3d

View File

@@ -476,9 +476,9 @@ class DF(File): # {{{
for i in indexes:
file = self.content[i]
if ((hasattr(file, attribute) and getattr(file, attribute)==value)
if (hasattr(file, attribute) and ((getattr(file, attribute)==value)
or (attribute == 'dfname' and getattr(file,
attribute).startswith(value))):
attribute).startswith(value)))):
return file
# not found
if isinstance(value, int):