From: Zac Medico Date: Wed, 12 Jul 2006 17:12:06 +0000 (-0000) Subject: Use startswith instead of slices to simplify config protect code. X-Git-Tag: v2.1.1~241 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=80637e497ee04ad79885af775e6d7dc96b346b63;p=portage.git Use startswith instead of slices to simplify config protect code. svn path=/main/trunk/; revision=3838 --- diff --git a/pym/portage.py b/pym/portage.py index 7a614dbd6..703c905c6 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -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)