def beamline(blid=None): session_init(session, db) beamlines = [] for _bldat in get_beamline_list(db): if _bldat['id'] == "%i" % blid: bldat = _bldat break spectra = spectra_for_beamline(db, blid) opts = {'nspectra': len(spectra), 'spectra': spectra} opts.update(bldat) beamlines.append(opts) return render_template('beamlines.html', nbeamlines=len(beamlines), beamlines=beamlines)
def beamlines(blid=None, orderby='id', reverse=0): session_init(session, db) beamlines = [] for bldat in get_beamline_list(db, orderby=orderby): blid = bldat['id'] spectra = spectra_for_beamline(db, blid) opts = {'nspectra': len(spectra), 'spectra': spectra} opts.update(bldat) beamlines.append(opts) reverse = int(reverse) if reverse: beamlines.reverse() reverse = 0 else: reverse = 1 return render_template('beamlines.html', nbeamlines=len(beamlines), beamlines=beamlines, reverse=reverse)