Repository: LMFDB/lmfdb

Issue:
Character orbit knowls on newforms are broken
After clicking for a random classical newform, we might find ourselves at a page like https://www.lmfdb.org/ModularForm/GL2/Q/holomorphic/5908/2/a/c/

This has character orbit `5908.a`. Clicking on that knowl shows a knowl stating "Invalid label for Dirichlet character: 5908.a". This is true, I suppose, as this should be a Dirichlet orbit (and `5908.a` is a valid orbit label). I suspect that we call the wrong knowl builder.

I think I should be able to examine this tomorrow.
Character orbit knowls on newforms are broken
After clicking for a random classical newform, we might find ourselves at a page like https://www.lmfdb.org/ModularForm/GL2/Q/holomorphic/5908/2/a/c/

This has character orbit `5908.a`. Clicking on that knowl shows a knowl stating "Invalid label for Dirichlet character: 5908.a". This is true, I suppose, as this should be a Dirichlet orbit (and `5908.a` is a valid orbit label). I suspect that we call the wrong knowl builder.

I think I should be able to examine this tomorrow.


Discussion:

Resolving patch:
diff --git a/lmfdb/characters/main.py b/lmfdb/characters/main.py
--- a/lmfdb/characters/main.py
+++ b/lmfdb/characters/main.py
@@ -533,33 +533,21 @@ def dirchar_data(label):
         return abort(404, f"Invalid label {label}")
 
 def _dir_knowl_data(label, orbit=False):
-    modulus, number = label.split('.')
-    modulus = int(modulus)
     try:
-        numbers = int(number)
-    except ValueError:
-        return "Invalid label for Dirichlet character: %s" % label
-    try:
-        if isinstance(numbers, list):
-            number = numbers[0]
-
-            def conrey_link(i):
-                return "<a href='%s'> %s.%s</a>" % (url_for("characters.render_Dirichletwebpage", modulus=modulus, number=i), modulus, i)
-            if len(numbers) <= 2:
-                numbers = [conrey_link(k) for k in numbers]
-            else:
-                numbers = [conrey_link(numbers[0]), '&#8230;', conrey_link(numbers[-1])]
+        parts = label.split('.')
+        modulus = int(parts[0])
+        if orbit:
+            assert(modulus <= ORBIT_MAX_MOD)
+            args = {'type': 'Dirichlet', 'modulus': modulus, 'orbit_label': parts[1]}
         else:
-            number = numbers
-            numbers = None
-
-        args = {'type': 'Dirichlet', 'modulus': modulus, 'number': number}
+            number = int(parts[1])
+            args = {'type': 'Dirichlet', 'modulus': modulus, 'number': number}
         webchar = make_webchar(args)
 
-        if orbit and modulus <= ORBIT_MAX_MOD:
+        if orbit:
             inf = "Dirichlet character orbit %s.%s\n" % (modulus, webchar.orbit_label)
         else:
-            inf = r"Dirichlet character \(\chi_{%s}(%s, \cdot)\)" % (modulus, number) + "\n"
+            inf = r"Dirichlet character \(\chi_{%s}(%s, \cdot)\)" % (modulus, parts[1]) + "\n"
         inf += "<div><table class='chardata'>\n"
 
         def row_wrap(header, val):
@@ -569,8 +557,6 @@ def row_wrap(header, val):
         inf += row_wrap('Degree', euler_phi(webchar.order))
         inf += row_wrap('Minimal', webchar.isminimal)
         inf += row_wrap('Parity', webchar.parity)
-        if numbers:
-            inf += row_wrap('Characters', ",&nbsp;".join(numbers))
         if modulus <= ORBIT_MAX_MOD:
             if not orbit:
                 inf += row_wrap('Orbit label', '%s.%s' % (modulus, webchar.orbit_label))
@@ -580,7 +566,7 @@ def row_wrap(header, val):
             inf += '<div align="right">\n'
             inf += '<a href="%s">%s.%s home page</a>\n' % (str(url_for("characters.render_Dirichletwebpage", modulus=modulus, orbit_label=webchar.orbit_label)), modulus, webchar.orbit_label)
             inf += '</div>\n'
-        elif numbers is None:
+        else:
             inf += '<div align="right">\n'
             inf += '<a href="%s">%s home page</a>\n' % (str(url_for("characters.render_Dirichletwebpage", modulus=modulus, number=number)), label)
             inf += '</div>\n'
diff --git a/lmfdb/characters/web_character.py b/lmfdb/characters/web_character.py
--- a/lmfdb/characters/web_character.py
+++ b/lmfdb/characters/web_character.py
@@ -1140,6 +1140,7 @@ def _populate_from_db(self):
         self.isminimal = bool_string(orbit_data['is_minimal'])
         self.parity = parity_string(int(orbit_data['parity']))
         self._set_kernel_field_poly(orbit_data)
+        self.orbit_index = orbit_data['orbit_index']
         self.inducing = orbit_data['primitive_label']
         self.ind_orbit_label = self.inducing.split(".")[1]
 


Test patch: