Use startswith instead of slices to simplify config protect code.
authorZac Medico <zmedico@gentoo.org>
Wed, 12 Jul 2006 17:12:06 +0000 (17:12 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 12 Jul 2006 17:12:06 +0000 (17:12 -0000)
svn path=/main/trunk/; revision=3838

pym/portage.py

index 7a614dbd63d0311f00e98c1a8db97363020d965a..703c905c6b6e68c97a3571ce1f837e468c5de1ff 100644 (file)
@@ -5826,11 +5826,11 @@ class config_protect(object):
                masked=0
                protected=0
                for ppath in self.protect:
-                       if (len(ppath) > masked) and (obj[0:len(ppath)]==ppath):
+                       if len(ppath) > masked and obj.startswith(ppath):
                                protected=len(ppath)
                                #config file management
                                for pmpath in self.protectmask:
-                                       if (len(pmpath) >= protected) and (obj[0:len(pmpath)]==pmpath):
+                                       if len(pmpath) >= protected and obj.startswith(pmpath):
                                                #skip, it's in the mask
                                                masked=len(pmpath)
                return (protected > masked)