def insert_mythic_spell_records(curs, curs_list, section_id, mythic_spell): name = cap_words(mythic_spell['spell_source'].strip()) find_section(curs, name=name, type='spell') spell = curs.fetchone() use_curs = curs if not spell: for c in curs_list: find_section(c, name=name, type='spell') spell = c.fetchone() use_curs = c if spell: mythic_spell['spell_source'] = spell['name'] break if not spell: raise Exception("Cannot find spell %s" % name) insert_mythic_spell_detail(curs, **mythic_spell)
def _spell_insert(curs, curs_list, section, section_id): insert_spell_records(curs, curs_list, section_id, section) if section.get('subtype') == 'mythic_spell': section['spell_source'] = section['name'] insert_mythic_spell_detail(curs, section_id, section['spell_source'])