internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: LMFDB/lmfdb

Issue:
Repeated search yields fewer results for Sato-Tate
When searching for Sato-Tate groups, the search counts drops by 2 every time you search. To reproduce this, start at http://beta.lmfdb.org/SatoTateGroup/?rational_only=yes&count=25 and click on 'Search again'.


Discussion:
It is also not displaying all the results it should (21 of 57 on the first search).  And the default count should be 50 not 25.
I'm looking at this now


Resolving patch:
diff --git a/lmfdb/sato_tate_groups/main.py b/lmfdb/sato_tate_groups/main.py
--- a/lmfdb/sato_tate_groups/main.py
+++ b/lmfdb/sato_tate_groups/main.py
@@ -229,7 +229,7 @@ def search(**args):
                      'learnmore':learnmore_list()}
     title = 'Sato-Tate Group Search Results'
     err_title = 'Sato-Tate Groups Search Input Error'
-    count = parse_count(info, 25)
+    count = parse_count(info, 50)
     start = parse_start(info)
     # if user clicked refine search always restart at 0
     if 'refine' in info:
@@ -293,8 +293,8 @@ def search(**args):
                 results.append(v)
     else:
         info['number'] = 'infinity'
-        info['start'] = start
-        info['count'] = count
+    info['start'] = start
+    info['count'] = count
 
     info['st0_list'] = st0_list
     info['st0_dict'] = st0_dict


Test patch:
diff --git a/lmfdb/sato_tate_groups/test_st.py b/lmfdb/sato_tate_groups/test_st.py
--- a/lmfdb/sato_tate_groups/test_st.py
+++ b/lmfdb/sato_tate_groups/test_st.py
@@ -49,6 +49,8 @@ def test_browse(self):
         assert 'matches 1001-1025' in L.data
         L = self.tc.get('SatoTateGroup/?degree=1')
         assert 'both matches' in L.data
+        L = self.tc.get('SatoTateGroup/?count=47')
+        assert '1-47' in L.data
 
     def test_moments(self):
         L = self.tc.get('/SatoTateGroup/1.4.6.1.1a')
Repository: LMFDB/lmfdb

Issue:
HTTP over SSL
Hello,

at some point in the future, we should wonder about getting the lmfdb running over SSL, at least the login page.



Discussion:
Yes please :)

Resolving patch:
diff --git a/lmfdb/app.py b/lmfdb/app.py
--- a/lmfdb/app.py
+++ b/lmfdb/app.py
@@ -196,14 +196,17 @@ def urlencode(kwargs):
 ##############################
 
 @app.before_request
-def redirect_nonwww():
-    """Redirect lmfdb.org requests to www.lmfdb.org"""
+def force_www_and_ssl():
+    """Redirect lmfdb.org requests to www.lmfdb.org and forces https"""
     from urlparse import urlparse, urlunparse
     urlparts = urlparse(request.url)
-    if urlparts.netloc == 'lmfdb.org':
-        replaced = urlparts._replace(netloc='www.lmfdb.org')
+    if (
+        urlparts.netloc == "www.lmfdb.org" and urlparts.scheme == "http"
+    ) or urlparts.netloc == "lmfdb.org":
+        replaced = urlparts._replace(netloc="www.lmfdb.org", scheme="https")
         return redirect(urlunparse(replaced), code=301)
 
+
 def timestamp():
     return '[%s UTC]'%time.strftime("%Y-%m-%d %H:%M:%S",time.gmtime())
 


Test patch:
Repository: LMFDB/lmfdb

Issue:
buffered cursors leave locks behind
When looping over search results without a limit, we use buffered cursors, so one doesn't need to download the full result before starting to loop over it.
However, these cursors leave locks behind, as they start a transaction automatically, see: 
https://github.com/psycopg/psycopg2/issues/987

We need to workaround this, as it is easy for some one to leave a session open in some server, and block anyone from modifying the table.


Discussion:
@roed314, do you recall why we claim that buffered and commit are incompatible?
https://github.com/LMFDB/lmfdb/blob/master/lmfdb/backend/database.py#L372

Resolving patch:
diff --git a/lmfdb/backend/database.py b/lmfdb/backend/database.py
--- a/lmfdb/backend/database.py
+++ b/lmfdb/backend/database.py
@@ -341,8 +341,9 @@ def _execute(self, query, values=None, silent=None, values_list=False,
         - ``slow_note`` -- a tuple for generating more useful data for slow query logging.
         - ``reissued`` -- used internally to prevent infinite recursion when attempting to
             reset the connection.
-        - ``buffered`` -- whether to create a server side cursor that must be
-            manually closed after using it, this implies ``commit=False``.
+        - ``buffered`` -- whether to create a server side cursor that must be manually
+            closed and connection committed  (to closed the transaction) after using it,
+            this implies ``commit=False``.
 
         .. NOTE:
 
@@ -1592,6 +1593,9 @@ def _search_iterator(self, cur, search_cols, extra_cols, projection):
         finally:
             if isinstance(cur, pg_cursor):
                 cur.close()
+                if (cur.withhold and # to assure that it is a buffered cursor
+                    self._db._nocommit_stack == 0): # and there is nothing to commmit
+                    cur.connection.commit()
 
     ##################################################################
     # Methods for querying                                           #


Test patch:
Repository: LMFDB/lmfdb

Issue:
Dirichlet characters that are Kronecker symbols should link back to the field
For example, http://www.lmfdb.org/Character/Dirichlet/5/4 should link to http://www.lmfdb.org/NumberField/2.2.5.1


Discussion:

Resolving patch:
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
@@ -1166,6 +1166,13 @@ def friends(self):
             )
         if len(self.vflabel) > 0:
             friendlist.append( ("Value Field", '/NumberField/' + self.vflabel) )
+        if self.symbol_numerator():
+            if self.symbol_numerator() > 0:
+                assoclabel = '2.2.%d.1' % self.symbol_numerator()
+            else:
+                assoclabel = '2.0.%d.1' % -self.symbol_numerator()
+            friendlist.append(("Associated quadratic field", '/NumberField/' + assoclabel))
+
         label = "%s.%s"%(self.modulus, self.number)
         myrep = db.artin_reps.lucky({'Dets': {'$contains': label}})
         if not myrep is None:


Test patch:
Repository: LMFDB/lmfdb

Issue:
Display of Hecke characteristic polynomials in large spaces is odd
See https://www.lmfdb.org/ModularForm/GL2/Q/holomorphic/9450/2/a/ at the bottom the hecke characteristic polynomials for 3 and 5 display as a lot of empty brackets.


Discussion:

Resolving patch:
diff --git a/lmfdb/classical_modular_forms/web_space.py b/lmfdb/classical_modular_forms/web_space.py
--- a/lmfdb/classical_modular_forms/web_space.py
+++ b/lmfdb/classical_modular_forms/web_space.py
@@ -194,7 +194,7 @@ def td_wrap(val):
             #t3 = clock()
             #factor_time += (t3-t2)
             F_p = make_bigint(r'\( %s \)' % F_p)
-            if (F_p != "1") and (len(F_p) > 0):
+            if (F_p != "\( 1 \)") and (len(F_p) > 6):
                 if (F_p[0] != '(') and (num_forms > 1):
                     F_p = '(' + F_p + ')'
                 hecke_polys_orbits[poly_item['p']] = hecke_polys_orbits.get(poly_item['p'], "") +  F_p
@@ -210,7 +210,7 @@ def td_wrap(val):
              '  </tr>', '</thead>', '<tbody>']
     loop_count = 0
     for p, lpoly in hecke_polys_orbits.items():
-        if lpoly == "":
+        if lpoly.strip() == "":
             lpoly = "1";
         if loop_count < num_disp:
             polys.append('  <tr>')


Test patch:
Repository: LMFDB/lmfdb

Issue:
Broken link in CMFs
Starting from the CMFs page, I click on the "dimension table" button to get to
  https://www.lmfdb.org/ModularForm/GL2/Q/holomorphic/?search_type=Dimensions&all=1
and then I click on any one of the spaces, and it tells me
  The page you are looking for has produced a server error,
e.g. https://www.lmfdb.org/ModularForm/GL2/Q/holomorphic/?search_array=%3Clmfdb.classical_modular_forms.main.CMFSearchArray+object+at+0x7faba3b6b1d0%3E&search_type=List&all=1&weight=7&level=17&count=50

Looks like something's wrong in the HTML generated...
Broken link in CMFs
Starting from the CMFs page, I click on the "dimension table" button to get to
  https://www.lmfdb.org/ModularForm/GL2/Q/holomorphic/?search_type=Dimensions&all=1
and then I click on any one of the spaces, and it tells me
  The page you are looking for has produced a server error,
e.g. https://www.lmfdb.org/ModularForm/GL2/Q/holomorphic/?search_array=%3Clmfdb.classical_modular_forms.main.CMFSearchArray+object+at+0x7faba3b6b1d0%3E&search_type=List&all=1&weight=7&level=17&count=50

Looks like something's wrong in the HTML generated...


Discussion:

Resolving patch:
diff --git a/lmfdb/classical_modular_forms/main.py b/lmfdb/classical_modular_forms/main.py
--- a/lmfdb/classical_modular_forms/main.py
+++ b/lmfdb/classical_modular_forms/main.py
@@ -916,6 +916,7 @@ def dimension_space_postprocess(res, info, query):
     urlgen_info.pop('number', None)
     urlgen_info.pop('numforms', None)
     urlgen_info.pop('dim', None)
+    urlgen_info.pop('search_array', None)
     def url_generator_list(N, k):
         info_copy = dict(urlgen_info)
         info_copy['search_type'] = 'Spaces'
@@ -958,8 +959,10 @@ def switch_text(X, typ):
 def dimension_form_postprocess(res, info, query):
     urlgen_info = dict(info)
     urlgen_info['count'] = 50
+    # Remove entries that are unused for dimension tables
     urlgen_info.pop('hidden_search_type', None)
     urlgen_info.pop('number', None)
+    urlgen_info.pop('search_array', None)
     def url_generator(N, k):
         info_copy = dict(urlgen_info)
         info_copy['search_type'] = 'List'


Test patch:
Repository: LMFDB/lmfdb

Issue:
Conductor and discriminant are the wrong way round for genus 2 local invariants
Go to a random genus 2 curve, eg. https://www.lmfdb.org/Genus2Curve/Q/59049/a/177147/1 scroll to local invariants, the columns that says ord(N) and ord(Δ) are swapped, as the numbers refer to the opposites of the exponents at the top of the page.


Discussion:

Resolving patch:
diff --git a/lmfdb/genus2_curves/web_g2c.py b/lmfdb/genus2_curves/web_g2c.py
--- a/lmfdb/genus2_curves/web_g2c.py
+++ b/lmfdb/genus2_curves/web_g2c.py
@@ -528,7 +528,7 @@ def divisor_data(P):
     gentab.extend(['</tbody>', '</table>'])
     return '\n'.join(gentab)
 
-def local_table(D,N,tama,bad_lpolys):
+def local_table(N,D,tama,bad_lpolys):
     loctab = ['<table class="ntdata">', '<thead>', '<tr>',
               th_wrap('ag.bad_prime', 'Prime'),
               th_wrap('ag.conductor', r'ord(\(N\))'),
@@ -548,7 +548,7 @@ def local_table(D,N,tama,bad_lpolys):
             Lp = Lplist[0][1]
         else:
             Lp = '?'
-        loctab.extend([td_wrapr(p),td_wrapc(D.ord(p)),td_wrapc(N.ord(p)),td_wrapc(cp),td_wrapl(Lp)])
+        loctab.extend([td_wrapr(p),td_wrapc(N.ord(p)),td_wrapc(D.ord(p)),td_wrapc(cp),td_wrapl(Lp)])
         loctab.append('  </tr>')
     loctab.extend(['</tbody>', '</table>'])
     return '\n'.join(loctab)
@@ -730,7 +730,7 @@ def make_object(self, curve, endo, tama, ratpts, is_curve):
                 data['two_torsion_field_knowl'] = r"splitting field of \(%s\) with Galois group %s" % (intlist_to_poly(t[1]),group_display_knowl(t[2][0],t[2][1]))
 
             tamalist = [[item['p'],item['tamagawa_number']] for item in tama]
-            data['local_table'] = local_table (data['abs_disc'],data['cond'],tamalist,data['bad_lfactors_pretty'])
+            data['local_table'] = local_table (data['cond'],data['abs_disc'],tamalist,data['bad_lfactors_pretty'])
 
         else:
             # invariants specific to isogeny class


Test patch:
Repository: LMFDB/lmfdb

Issue:
Keyword Search Feature visible on Front Page?
It's hard for people using LMFDB the first time to notice the "knowledge" section on the sidebar and realize that it corresponds to a keyword search for knowls.

Currently the _Explore and Learn_ tab contains nothing but a diagram of the Langlands Program, and the diagram has clickable keywords. I don't know if a more detailed diagram with more keywords suffices as a visual keyword search, but the search feature should probably belong to this tab.


Discussion:

Resolving patch:
diff --git a/lmfdb/classical_modular_forms/web_newform.py b/lmfdb/classical_modular_forms/web_newform.py
--- a/lmfdb/classical_modular_forms/web_newform.py
+++ b/lmfdb/classical_modular_forms/web_newform.py
@@ -795,7 +795,7 @@ def order_basis(self):
             return html % ("", self._order_basis_forward(), self._nu_latex, " nodisplay", self._order_basis_inverse(), self._nu_latex)
 
     def order_basis_table(self):
-        s = '<table class="ntdata" style="padding-left: 14px;">\n  <tr>\n'
+        s = '<table class="ntdata">\n  <tr>\n'
         for i in range(self.dim):
             s += r'    <td>\(\nu^{%s}\)</td>\n'%i
         s += '    <td>Denominator</td>\n  </tr>\n'


Test patch:
Repository: LMFDB/lmfdb

Issue:
Keyword Search Feature visible on Front Page?
It's hard for people using LMFDB the first time to notice the "knowledge" section on the sidebar and realize that it corresponds to a keyword search for knowls.

Currently the _Explore and Learn_ tab contains nothing but a diagram of the Langlands Program, and the diagram has clickable keywords. I don't know if a more detailed diagram with more keywords suffices as a visual keyword search, but the search feature should probably belong to this tab.


Discussion:

Resolving patch:
diff --git a/lmfdb/app.py b/lmfdb/app.py
--- a/lmfdb/app.py
+++ b/lmfdb/app.py
@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 from __future__ import absolute_import
 import os
+from socket import gethostname
 import time
 import six
 
@@ -19,6 +20,10 @@
 ############################
 
 app = Flask(__name__)
+if gethostname().startswith('prodweb'):
+    app.config.update(dict(
+      PREFERRED_URL_SCHEME = 'https'
+    ))
 
 ############################
 # App attribute functions  #
@@ -323,7 +328,6 @@ def statshealth():
 
 @app.route("/info")
 def info():
-    from socket import gethostname
     output = ""
     output += "HOSTNAME = %s\n\n" % gethostname()
     output += "# PostgreSQL info\n"
diff --git a/lmfdb/classical_modular_forms/web_newform.py b/lmfdb/classical_modular_forms/web_newform.py
--- a/lmfdb/classical_modular_forms/web_newform.py
+++ b/lmfdb/classical_modular_forms/web_newform.py
@@ -795,7 +795,7 @@ def order_basis(self):
             return html % ("", self._order_basis_forward(), self._nu_latex, " nodisplay", self._order_basis_inverse(), self._nu_latex)
 
     def order_basis_table(self):
-        s = '<table class="ntdata" style="padding-left: 14px;">\n  <tr>\n'
+        s = '<table class="ntdata">\n  <tr>\n'
         for i in range(self.dim):
             s += r'    <td>\(\nu^{%s}\)</td>\n'%i
         s += '    <td>Denominator</td>\n  </tr>\n'


Test patch:
Repository: LMFDB/lmfdb

Issue:
Dirichlet pages do not list their modulus in their properties or gaga box
The information is contained in the label which is displayed as $\chi_m (n, \cdot)$, but to make things easier for newcomers it would be better if there was an explicit field in the basic properties section and the properties box giving the modulus of the character.
On pages like Character/Dirichlet/5/1

We already list this information in the search results as a separate column so this seems to be a (minor) oversight than a deliberate choice not to include duplicate info.


Discussion:
Agreed, I would put the modulus at the top right above the conductor.
Even more noticeably missing, there is no portrait!
Alex Best suggests using a pictorial representation of the Gauss sum (just plotting the roots of unity is a little boring).

Resolving patch:
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
@@ -767,10 +767,13 @@ def vflabel(self):
 
     @lazy_attribute
     def properties(self):
-        f = [("Conductor", [self.conductor]),
-                ("Order", [self.order]),
-                ("Real", [self.isreal]),
-                ("Primitive", [self.isprimitive])]
+        f = [
+            ("Modulus", [self.modulus]),
+            ("Conductor", [self.conductor]),
+            ("Order", [self.order]),
+            ("Real", [self.isreal]),
+            ("Primitive", [self.isprimitive])
+        ]
         if self.isminimal:
             f.append(("Minimal", [self.isminimal]))
         if self.parity:


Test patch:
Repository: LMFDB/lmfdb

Issue:
disable L-function download for non DB L-functions
```
Exception on /L/download_euler/ModularForm/GL2/TotallyReal/2.2.12.1/holomorphic/2.2.12.1-47.2-b/0/0/ [GET]
Traceback (most recent call last):
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/lmfdb/lmfdb-git-web/lmfdb/lfunctions/main.py", line 801, in download_euler
    return generateLfunctionFromUrl(*args).download_euler_factors()
AttributeError: 'Lfunction_HMF' object has no attribute 'download_euler_factors'
[2020-09-08 21:15:54 UTC] 500 error on URL https://www.lmfdb.org/L/download_euler/ModularForm/GL2/TotallyReal/2.2.12.1/holomorphic/2.2.12.1-47.2-b/0/0/
```

maybe there are other families L-functions with the same issue.


Discussion:

Resolving patch:
diff --git a/lmfdb/lfunctions/main.py b/lmfdb/lfunctions/main.py
--- a/lmfdb/lfunctions/main.py
+++ b/lmfdb/lfunctions/main.py
@@ -969,7 +969,7 @@ def generateLfunctionFromUrl(*args, **kwds):
             return Lfunction_CMF_orbit(level=args[4], weight=args[5], char_orbit_label=args[6], hecke_orbit=args[7])
 
     elif args[0] == 'ModularForm' and args[1] == 'GL2' and args[2] == 'TotallyReal' and args[4] == 'holomorphic':  # Hilbert modular form
-        instance = db.lfunc_instances.lucky({'url': hmf_url(args[6], args[6], args[7])})
+        instance = db.lfunc_instances.lucky({'url': hmf_url(args[5], args[6], args[7])})
         return Lfunction_HMFDB(label=args[5], character=args[6], number=args[7]) if instance else Lfunction_HMF(label=args[5], character=args[6], number=args[7])
 
     elif args[0] == 'ModularForm' and args[1] == 'GL2' and args[2] == 'ImaginaryQuadratic':  # Bianchi modular form


Test patch:
Repository: LMFDB/lmfdb

Issue:
Downloading new space
```
Exception on /ModularForm/GL2/Q/holomorphic/download_full_space/1369.2 [GET]
Traceback (most recent call last):
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/lmfdb/lmfdb-git-web/lmfdb/classical_modular_forms/main.py", line 571, in download_full_space
    return CMF_download().download_full_space(label)
  File "/home/lmfdb/lmfdb-git-web/lmfdb/classical_modular_forms/download.py", line 335, in download_full_space
    data['newforms'] = sum([[form['label'] for form in forms] for spc, forms in space.decomp], [])
  File "/home/lmfdb/lmfdb-git-web/lmfdb/classical_modular_forms/download.py", line 335, in <listcomp>
    data['newforms'] = sum([[form['label'] for form in forms] for spc, forms in space.decomp], [])
TypeError: 'NoneType' object is not iterable
[2020-09-11 12:23:54 UTC] 500 error on URL https://www.lmfdb.org/ModularForm/GL2/Q/holomorphic/download_full_space/1369.2
```


Discussion:

Resolving patch:
diff --git a/lmfdb/classical_modular_forms/download.py b/lmfdb/classical_modular_forms/download.py
--- a/lmfdb/classical_modular_forms/download.py
+++ b/lmfdb/classical_modular_forms/download.py
@@ -332,7 +332,9 @@ def download_full_space(self, label, lang='text'):
         for attr in ['level', 'weight', 'label', 'oldspaces']:
             data[attr] = getattr(space, attr)
         data['newspaces'] = [spc['label'] for spc, forms in space.decomp]
-        data['newforms'] = sum([[form['label'] for form in forms] for spc, forms in space.decomp], [])
+        data['newforms'] = sum([[form['label'] for form in forms] if spc.get('num_forms') is not None else [None] for spc, forms in space.decomp], [])
+        if None in data['newforms']:
+            data.pop('newforms')
         data['dimgrid'] = space.dim_grid._grid
         return self._wrap(Json.dumps(data),
                           label,


Test patch:
Repository: LMFDB/lmfdb

Issue:
p-adic fields statistics broken
Just what the title says.

I saw a mention of it in a pull request, but it there does not seem to be an issue for it.

As far as I can tell, it happened when there were changes to statstable.py for Bianchi modular form statistics.  Now in a list of headers which is supposed to be just values of "n" or "e" it is picking up Galois groups.


Discussion:
David Roe is aware of the issue and is working on it.  We are holding off pushing to web until this is fixed.
Yep, I'm looking at this now.

Resolving patch:
diff --git a/lmfdb/backend/statstable.py b/lmfdb/backend/statstable.py
--- a/lmfdb/backend/statstable.py
+++ b/lmfdb/backend/statstable.py
@@ -1551,9 +1551,9 @@ def _get_values_counts(
                             else:
                                 raise ValueError("Unsupported constraint key: %s" % k)
                             selecter_constraints.append(SQL(
-                                "(values->{0}?%s AND (values->{0}->>%s)::{1} {3} %s) OR "
+                                "((values->{0}?%s AND (values->{0}->>%s)::{1} {3} %s) OR "
                                 "(values->{0}?%s AND (values->{0}->>%s)::{1} {2} %s) OR "
-                                "(jsonb_typeof(values->{0}) = %s AND (values->>{0})::{1} {2} %s)".format(
+                                "(jsonb_typeof(values->{0}) = %s AND (values->>{0})::{1} {2} %s))".format(
                                     i, typ, op, oe)))
                             selecter_values.extend([k, k, v, ko, ko, v, "number", v])
                     else:


Test patch:
Repository: LMFDB/lmfdb

Issue:
Random link for Dirichlet characters is broken
https://www.lmfdb.org/Character/Dirichlet/random gives an invalid label error (two in fact).

Also, three error messages are displayed when you enter the label "banana".    Only one should be displayed.


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
@@ -189,6 +189,7 @@ def url_for_label(label):
     shortcuts={ "jump": jump },
     url_for_label=url_for_label,
     learnmore=learn,
+    random_projection="label",
     bread=lambda: bread("Search results"),
     credit=credit,
 )


Test patch: