def redirect_false_route(level=None,weight=None,character=None,label='',emb=None): ## jumps only have one field (here level) if weight is None: args = extract_data_from_jump_to(level) emf_logger.debug("args={0}".format(args)) else: args = {'level':level,'weight':weight,'character':character,'label':label} #validate_parameters(level,weight,character,label,args) return redirect(url_for("emf.render_elliptic_modular_forms",**args), code=301)
def render_elliptic_modular_forms(level=0, weight=0, character=None, label='', **kwds): r""" Default input of same type as required. Note that for holomorphic modular forms: level=0 or weight=0 are non-existent. """ if character is None and level == 0 and weight == 0: character = 1 elif character is None: character = -1 emf_logger.debug( "In render: level={0},weight={1},character={2},label={3}".format( level, weight, character, label)) emf_logger.debug("args={0}".format(request.args)) emf_logger.debug("args={0}".format(request.form)) emf_logger.debug("met={0}".format(request.method)) keys = ['download', 'jump_to'] info = get_args(request, level, weight, character, label, keys=keys) level = info['level'] weight = info['weight'] character = info['character'] label = info['label'] emf_logger.debug("info={0}".format(info)) emf_logger.debug("level=%s, %s" % (level, type(level))) emf_logger.debug("label=%s, %s" % (label, type(label))) emf_logger.debug("wt=%s, %s" % (weight, type(weight))) emf_logger.debug("character=%s, %s" % (character, type(character))) if 'download' in info: return get_downloads(**info) emf_logger.debug("info=%s" % info) ## Consistency of arguments> # if level<=0: level=None # if weight<=0: weight=None if 'jump_to' in info: # try to find out which form we want to jump s = my_get(info, 'jump_to', '', str) emf_logger.info("info.keys1={0}".format(info.keys())) info.pop('jump_to') emf_logger.info("info.keys2={0}".format(info.keys())) args = extract_data_from_jump_to(s) emf_logger.debug("args=%s" % args) return redirect(url_for("emf.render_elliptic_modular_forms", **args), code=301) # return render_elliptic_modular_forms(**args) if level > 0 and weight > 0 and character > 0 and label != '': emf_logger.debug("info=%s" % info) return render_web_newform(**info) if level > 0 and weight > 0 and character > 0: return render_web_modform_space(**info) if level > 0 and weight > 0: return render_web_modform_space_gamma1(**info) # Otherwise we go to the main navigation page return render_elliptic_modular_form_navigation_wp(**info)
def render_elliptic_modular_forms(level=0, weight=0, character=None, label='', **kwds): r""" Default input of same type as required. Note that for holomorphic modular forms: level=0 or weight=0 are non-existent. """ if character is None and level == 0 and weight == 0: character = 1 elif character is None: character = -1 emf_logger.debug( "In render: level={0},weight={1},character={2},label={3}".format(level, weight, character, label)) emf_logger.debug("args={0}".format(request.args)) emf_logger.debug("args={0}".format(request.form)) emf_logger.debug("met={0}".format(request.method)) keys = ['download', 'jump_to'] info = get_args(request, level, weight, character, label, keys=keys) level = info['level'] weight = info['weight'] character = info['character'] label = info['label'] emf_logger.debug("info={0}".format(info)) emf_logger.debug("level=%s, %s" % (level, type(level))) emf_logger.debug("label=%s, %s" % (label, type(label))) emf_logger.debug("wt=%s, %s" % (weight, type(weight))) emf_logger.debug("character=%s, %s" % (character, type(character))) if 'download' in info: return get_downloads(**info) emf_logger.debug("info=%s" % info) ## Consistency of arguments> # if level<=0: level=None # if weight<=0: weight=None if 'jump_to' in info: # try to find out which form we want to jump s = my_get(info, 'jump_to', '', str) emf_logger.info("info.keys1={0}".format(info.keys())) info.pop('jump_to') emf_logger.info("info.keys2={0}".format(info.keys())) args = extract_data_from_jump_to(s) emf_logger.debug("args=%s" % args) return redirect(url_for("emf.render_elliptic_modular_forms", **args), code=301) # return render_elliptic_modular_forms(**args) if level > 0 and weight > 0 and character > 0 and label != '': emf_logger.debug("info=%s" % info) return render_web_newform(**info) if level > 0 and weight > 0 and character > 0: return render_web_modform_space(**info) if level > 0 and weight > 0: return render_web_modform_space_gamma1(**info) # Otherwise we go to the main navigation page return render_elliptic_modular_form_navigation_wp(**info)
def render_elliptic_modular_forms(level=None, weight=None, character=None, label=None,group=None, **kwds): r""" Default input of same type as required. Note that for holomorphic modular forms: level=0 or weight=0 are non-existent. """ emf_logger.debug( "In render: level={0},weight={1},character={2},group={3},label={4}".format(level, weight, character, group, label)) emf_logger.debug("args={0}".format(request.args)) emf_logger.debug("args={0}".format(request.form)) emf_logger.debug("met={0}".format(request.method)) keys = ['download', 'jump_to'] info = get_args(request, level, weight, character, group, label, keys=keys) valid = validate_parameters(level,weight,character,label,info) if isinstance(valid,basestring): return redirect(valid,code=301) level = info['level']; weight = info['weight']; character = info['character'] #if info.has_key('error'): # return render_elliptic_modular_form_navigation_wp(error=info['error']) emf_logger.debug("info={0}".format(info)) emf_logger.debug("level=%s, %s" % (level, type(level))) emf_logger.debug("label=%s, %s" % (label, type(label))) emf_logger.debug("wt=%s, %s" % (weight, type(weight))) group = info.get('group',None) emf_logger.debug("group=%s, %s" % (group, type(group))) if group == 0: info['character'] = character = 1 # only trivial character for Gamma_0(N) try: if 'download' in info: return get_downloads(**info) emf_logger.debug("info=%s" % info) ## Consistency of arguments> # if level<=0: level=None # if weight<=0: weight=None if 'jump_to' in info: # try to find out which form we want to jump s = my_get(info, 'jump_to', '', str) emf_logger.info("info.keys1={0}".format(info.keys())) info.pop('jump_to') emf_logger.info("info.keys2={0}".format(info.keys())) args = extract_data_from_jump_to(s) emf_logger.debug("args=%s" % args) return redirect(url_for("emf.render_elliptic_modular_forms", **args), code=301) # return render_elliptic_modular_forms(**args) emf_logger.debug("HERE! weight={0} level={1} char={2}".format(weight,level,character)) if level > 0 and weight > 0 and character > 0: if label != '' and not label is None: return render_web_newform(**info) else: return render_web_modform_space(**info) if level > 0 and weight > 0 and (group != 0 or character == None): return render_web_modform_space_gamma1(**info) return render_elliptic_modular_form_navigation_wp(**info) # Otherwise we go to the main navigation page except IndexError as e: # catch everything here except KeyError below... emf_logger.debug("catching exceptions. info={0}".format(info)) errst = str(e) ## Try to customise some of the error messages: if 'Character' and 'not exist' in errst: errst += " Please choose a character from the table below!" flash(errst,'error') return render_elliptic_modular_form_navigation_wp(**info) if 'WebNewForm_computing' in errst: errst = "The space {0}.{1}.{2} is not in the database!".format(level,weight,character) flash(errst) return render_elliptic_modular_form_navigation_wp() except KeyError as e: emf_logger.debug("catching exceptions. info={0}".format(info)) errst = "The space {0}.{1}.{2} is not in the database!".format(level,weight,character) flash(errst) return render_elliptic_modular_form_navigation_wp()
def render_elliptic_modular_forms(level=None, weight=None, character=None, label=None, group=None, **kwds): r""" Default input of same type as required. Note that for holomorphic modular forms: level=0 or weight=0 are non-existent. """ emf_logger.debug( "In render: level={0},weight={1},character={2},group={3},label={4}". format(level, weight, character, group, label)) emf_logger.debug("args={0}".format(request.args)) emf_logger.debug("args={0}".format(request.form)) emf_logger.debug("met={0}".format(request.method)) keys = ['download', 'jump_to'] info = get_args(request, level, weight, character, group, label, keys=keys) valid = validate_parameters(level, weight, character, label, info) if isinstance(valid, basestring): return redirect(valid, code=301) level = info['level'] weight = info['weight'] character = info['character'] #if info.has_key('error'): # return render_elliptic_modular_form_navigation_wp(error=info['error']) emf_logger.debug("info={0}".format(info)) emf_logger.debug("level=%s, %s" % (level, type(level))) emf_logger.debug("label=%s, %s" % (label, type(label))) emf_logger.debug("wt=%s, %s" % (weight, type(weight))) group = info.get('group', None) emf_logger.debug("group=%s, %s" % (group, type(group))) if group == 0: info[ 'character'] = character = 1 # only trivial character for Gamma_0(N) try: if 'download' in info: return get_downloads(**info) emf_logger.debug("info=%s" % info) ## Consistency of arguments> # if level<=0: level=None # if weight<=0: weight=None if 'jump_to' in info: # try to find out which form we want to jump s = my_get(info, 'jump_to', '', str) emf_logger.info("info.keys1={0}".format(info.keys())) info.pop('jump_to') emf_logger.info("info.keys2={0}".format(info.keys())) args = extract_data_from_jump_to(s) emf_logger.debug("args=%s" % args) return redirect(url_for("emf.render_elliptic_modular_forms", **args), code=301) # return render_elliptic_modular_forms(**args) emf_logger.debug("HERE! weight={0} level={1} char={2}".format( weight, level, character)) if level > 0 and weight > 0 and character > 0: if label != '' and not label is None: return render_web_newform(**info) else: return render_web_modform_space(**info) if level > 0 and weight > 0 and (group != 0 or character == None): return render_web_modform_space_gamma1(**info) return render_elliptic_modular_form_navigation_wp(**info) # Otherwise we go to the main navigation page except IndexError as e: # catch everything here except KeyError below... emf_logger.debug("catching exceptions. info={0} e={1}".format(info, e)) errst = str(e) ## Try to customise some of the error messages: if 'Character' and 'not exist' in errst: errst += " Please choose a character from the table below!" flash(errst, 'error') return render_elliptic_modular_form_navigation_wp(**info) if 'WebNewForm_computing' in errst: errst = "The space {0}.{1}.{2} is not in the database!".format( level, weight, character) flash(errst) return render_elliptic_modular_form_navigation_wp() except KeyError as e: emf_logger.debug("catching exceptions. info={0} e={1}".format(info, e)) errst = "The orbit {0} is not in the database!".format( newform_label(level, weight, character, label)) flash(errst) return render_elliptic_modular_form_navigation_wp()
def redirect_false_route(test=None): args = extract_data_from_jump_to(test) return redirect(url_for("emf.render_elliptic_modular_forms",**args), code=301)