示例#1
0
    
    print "Location: /cgi-bin/diz.py?sid=%s\n" % sid
    sys.exit()

else:
    pass


# NOW SHOW THE RESULTS

template, tproc = cfg.tmpl("anas", sid)

tproc.set('cmd_file', file(cfn).read())

anas = datana.fanas(wanafn)
vns  = cfg.vars(sdir)

pvscmds = pervar.get_cmds(sfn("pervar"))

def banas():
    anakeys = "name vix min max numvc ascvc misc type cmd".split()
    for vix, a, vn in izip(count(), anas, vns):
        pvcmds = pvscmds[str(vix)]
        vcmds = [cmd +" " +pvcmds[cmd]
                 for cmd in ('addval', 'delval', 'DIS', 'IMP')
                 if cmd in pvcmds]
        a['name'] = vn
        a['vix']  = vix
        a['cmd']  = varcmd.join(sx, *(vcmds))

        yield dict(zip(anakeys, map(a.get, anakeys)))
示例#2
0
opts.append(("--delim", form.getfirst("delim")))
opts.append(("--names", handle_names()))
opts.append(("--start", form.getfirst("start")))
opts.append(("--miss", form.getfirst('missmark')))
opts.append(("--rowise", form.getfirst("rowise") == "yes"))
opts.append(("--cmd-file", cfn))
opts.extend(cfg.sx_options(sx))

############################ ACTION  ##########################

cfg.save_cmds(cfn, form.getfirst("cmd_file"))

pargs = " ".join((sfn("dat.org"), sdir))
cmd = "python2.4 pydida/din.py %s %s" % (pargs, cfg.optcat(*opts))
# raise cmd
to_cmd, from_cmd, cmderr = os.popen3(cmd)
err = cmderr.read()
ok = (not err) and int(from_cmd.readline())

######################### FORM OUTPUT ##########################

if ok:
    pervar.create_cmds(len(cfg.vars(sdir)), sfn("pervar")).close()
    print "Location: /cgi-bin/anas.py?sid=%s&action=First\n" % sid
else:
    if err:
        cfg.error(err, sid)
    else:
        cfg.error(from_cmd.read(), sid)
示例#3
0
        'freq': f,
        'height': h
    } for f, h in zip(freqs, heights)])

    tproc.set("Coords_a", [{'coord': c} for c in coords])
    tproc.set("Axis_a", range(len(coords)))


nth = lambda i, n: islice(i, n, n + 1).next()

######################## FORM INPUT ##################

form = cgi.FieldStorage()
sid, sdir, sfn, wfn, cfn, sx = cfg.get_session(form)
vix = int(form.getfirst("vix", 0))
vns = cfg.vars(sdir)

# READ COMMANDS FROM PERVAR OR FORM

form2cmd = {
    'addval': 'addval',
    'delval': 'delval',
    'dzcmd': 'DIS',
    'impcmd': 'IMPUTE'
}

cmd_args = {}

if form.getfirst("action") not in ("Test", "Accept"):
    pvcmds = pervar.get_cmds(sfn("pervar"), wb=True)[str(vix)]
    for fcmd, cmd in form2cmd.iteritems():