def return_dimension(level=None, weight=None, chi=None, **kwds): if request.method == 'GET': info = to_dict(request.args) else: info = to_dict(request.form) level = my_get(info, 'level', level, int) weight = my_get(info, 'weight', weight, int) chi = my_get(info, 'chi', chi, int) if level is None or weight is None: return emf_error("Please supply level weight (and optional character)!"), 500 ttype = my_get(kwds, 'ttype', info.get('ttype', 'new'), str) emf_logger.debug("level,weight,chi: {0},{1},{2}, type={3}".format(level, weight, chi, ttype)) if chi == 0 or chi is None: x = level else: x = DirichletGroup(level).list()[chi] if ttype == 'new': return str(dimension_new_cusp_forms(x, weight)) if ttype == 'cusp': return str(dimension_cusp_forms(x, weight)) if ttype == 'modular': return str(dimension_modular_forms(x, weight)) if ttype == 'eisenstein': return str(dimension_eis(x, weight)) s = "Please use one of the available table types: 'new', 'cusp','modular', 'eisenstein' Got:{0}".format( ttype) return emf_error(s), 500
def render_table(level, **kwds): r""" Return a html table with appropriate dimensions. """ nrows = my_get(kwds, 'nrows', 10, int) ncols = my_get(kwds, 'ncols', 10, int) ttype = my_get(kwds, 'ttype', 'newforms', str)
def draw_table(nrows=None, ncols=None, **kwds): if request.method == 'GET': info = to_dict(request.args) else: info = to_dict(request.form) ncols = my_get(info, 'ncols', ncols, int) nrows = my_get(info, 'nrows', nrows, int) if nrows is None or ncols is None: return emf_error("Please supply level weight (and optional character)!"), 500 ttype = my_get(info, 'ttype', 'new', str) ttype = my_get(kwds, 'ttype', info.get('ttype'), str) info = to_dict(kwds) ttype = my_get(kwds, 'ttype', 'new', str) info['title'] = 'Title of table' info['ttype'] = ttype info['nrows'] = nrows info['ncols'] = ncols return render_template("emf_table2.html", **info)