def PUT(self): x = web.input() master = models.Master.get(id=x.get('master_id')) if not master: return web.notfound() form = LocalParamForm() if form.validates(): idlocal = form.d.idlocal values = form.d del values['idlocal'] del values['save'] if not int(idlocal): localparam = models.LocalParam.create(**values) web.ctx.orm.commit() master.idlocala = localparam.id else: models.LocalParam.update(id=idlocal, values=values) localparam = models.LocalParam.get(id=idlocal) web.ctx.orm.commit() master.idlocala = localparam.id project = master.project result = get_glyphs_jsondata(project.currentglyph, master) return ujson.dumps(result)
def POST(self): postdata = web.input(project_id=0, label='', value=0, glyphname='') project = models.Project.get(id=postdata.project_id) if not project: raise web.notfound() models.Metapolation.update(label=postdata.label, project_id=postdata.project_id, values={'value': float(postdata.value)}) web.ctx.orm.commit() masters = project.get_ordered_masters() result = get_glyphs_jsondata(postdata.glyphname, masters[0]) return ujson.dumps(result)
def POST(self): postdata = web.input(glyphpoint_id='') if not models.GlyphPoint.exists(id=postdata.glyphpoint_id): return web.notfound() glyphpoint = models.GlyphPoint.get(id=postdata.glyphpoint_id) project = models.Project.get(id=glyphpoint.glyph.project_id) if not project: raise web.notfound() master = models.Master.get(id=glyphpoint.glyph.master_id) if not master: return web.notfound() form = PointParamExtendedForm() if form.validates(): values = form.d glyphpoint.x = float(values['x']) glyphpoint.y = float(values['y']) glyphpoint.glyph.width = int(values['width']) glyphpoint.glyph.width_new = int(values['width_new']) del values['zpoint'] del values['x'] del values['y'] del values['width'] del values['width_new'] for key in values: if values[key] == '': values[key] = None models.GlyphPointParam.update(glyphpoint_id=postdata.glyphpoint_id, values=values) result = get_glyphs_jsondata(glyphpoint.glyph.name, master) return ujson.dumps(result)