- row_key = dict(table=unicode(cls.__tablename__),
- row_id=unicode(row.id),
- forme_name=u'__empty__')
+ row_keys = [
+ dict(table=unicode(cls.__tablename__),
+ row_id=unicode(row.id),
+ forme_name=u'__empty__')
+ ]
+
+ # If this is a form, mark it as such
+ # XXX foreign form names...?
+ if getattr(row, 'forme_name', None):
+ # ...but if it's also the *default* form, index the name
+ # bare too
+ if not getattr(row, 'forme_base_pokemon_id', None):
+ new_key = row_keys[0].copy()
+ row_keys.append(new_key)
+
+ row_keys[0]['forme_name'] = row.forme_name