This is an example RD for a simple service
letting people do annotations to some object list through the
web interface. It's kept in the docs repo because Markus does not have a
live service that could show what do do for this kind of thing.
The tutorial assumes this is available at
http://docs.g-vo.org/editsample_q.rd
for id in range(int(self.sourceToken)):
yield dict(zip(
["id", "ra", "dec", "remarks"],
[id, random.random()*360, random.random()*180-90, None]))
return T.a(class_="buttonlike", href="/\rdId/edit/form?"
+urllib.parse.urlencode({
"id": data[0],
"remarks": data[1] or ""}))["Edit this"]
\internallink{\rdId/view}
with base.getWritableAdminConn() as conn:
if 1!=conn.execute("UPDATE \schema.objlist"
" SET remarks=%(remarks)s"
" WHERE id=%(id)s", inputTable.args):
raise base.ValidationError("No row for id '{}'".format(
inputTable.args["id"]), colName="id")
return rsc.TableForDef(
self.outputTable,
rows=list(conn.queryToDicts("SELECT * FROM \schema.objlist"
" WHERE id=%(id)s", inputTable.args)))
# or remove the return clause and let this run to redirect
# back to somewhere else, like the result display.
raise svcs.Found("/\rdId/view?"+urllib.parse.urlencode({
"id": inputTable.args["id"],
"__nevow_form__": "genForm"}))