Created
July 7, 2012 13:13
-
-
Save libbkmz/3066435 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def search_id(self, text): | |
for i, parent in enumerate(self.cats): | |
for j, sub in enumerate(parent.sub_rubs): | |
if sub.name == text: | |
return sub.id | |
if parent.name == text: | |
return parent.id | |
raise IndexError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment