projects
/
zzz-pokedex.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
d6e4099
)
Lookup now respects "ability" as a lookup type.
author
Eevee
<git@veekun.com>
Fri, 30 Apr 2010 07:22:03 +0000
(
00:22
-0700)
committer
Eevee
<git@veekun.com>
Fri, 30 Apr 2010 07:22:03 +0000
(
00:22
-0700)
pokedex/lookup.py
patch
|
blob
|
history
diff --git
a/pokedex/lookup.py
b/pokedex/lookup.py
index
ce5bb76
..
f029b77
100644
(file)
--- a/
pokedex/lookup.py
+++ b/
pokedex/lookup.py
@@
-290,15
+290,17
@@
class PokedexLookup(object):
Returns None for a bogus name.
"""
Returns None for a bogus name.
"""
+ # Table object
if hasattr(name, '__tablename__'):
return getattr(name, '__tablename__')
if hasattr(name, '__tablename__'):
return getattr(name, '__tablename__')
- elif name in self.indexed_tables:
- return name
- elif name + 's' in self.indexed_tables:
- return name + 's'
- else:
- # Bogus. Be nice and return dummy
- return None
+
+ # Table name
+ for table in self.indexed_tables.values():
+ if name in (table.__tablename__, table.__singlename__):
+ return table.__tablename__
+
+ # Bogus. Be nice and return dummy
+ return None
def _whoosh_records_to_results(self, records, exact=True):
"""Converts a list of whoosh's indexed records to LookupResult tuples
def _whoosh_records_to_results(self, records, exact=True):
"""Converts a list of whoosh's indexed records to LookupResult tuples