Skip to content

Commit

Permalink
Fix parsing when specifying both induced character and conductor
Browse files Browse the repository at this point in the history
  • Loading branch information
roed314 committed Nov 20, 2024
1 parent 00c9941 commit 1074796
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lmfdb/characters/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
TextBox, CountBox, parse_bool, parse_ints, search_wrap, raw_typeset_poly,
StatsDisplay, totaler, proportioners, comma, flash_warning, Downloader)
from lmfdb.utils.interesting import interesting_knowls
from lmfdb.utils.search_parsing import parse_range3
from lmfdb.utils.search_columns import SearchColumns, MathCol, LinkCol, CheckCol, ProcessedCol, MultiProcessedCol
from lmfdb.characters.utils import url_character
from lmfdb.characters.TinyConrey import ConreyCharacter
Expand Down Expand Up @@ -176,15 +177,26 @@ def common_parse(info, query):
primitive_orbit = class_to_int(parts_of_label[1])+1
if db.char_dirichlet.count({'modulus':primitive_modulus,'is_primitive':True,'orbit':primitive_orbit}) == 0:
raise ValueError("Primitive character orbit not found")
if 'conductor' in query and query['conductor'] != primitive_modulus:
def incompatible(query):
cond = query.get('conductor')
if cond is None:
return False
if isinstance(cond, int):
return cond != primitive_modulus
opts = parse_range3(info['conductor'], lower_bound=1, upper_bound=ORBIT_MAX_MOD)
for opt in opts:
if (isinstance(opt, int) and opt == primitive_modulus or
not isinstance(opt, int) and opt[0] <= primitive_modulus <= opt[1]):
return False
return True
if incompatible(query):
query["primitive_orbit"] = 0
else:
query["conductor"] = primitive_modulus
query["primitive_orbit"] = primitive_orbit
except ValueError:
flash_error("%s is not the label of a primitive character in the database", info['inducing'])
raise ValueError
return redirect(url_for(".render_DirichletNavigation"))
if 'parity' in info:
parity = info['parity']
if parity == 'even':
Expand Down

0 comments on commit 1074796

Please sign in to comment.