//Delete deletes the presentation record from Datastore and //its data file from Blobstore. func (p *Presentation) Delete(c appengine.Context) (err error) { err = action.DeleteFor(p, c) if err != nil { return } err = gaemodel.Delete(c, p) if err != nil { return } err = blobstore.Delete(c, p.BlobKey) return }
//SaveConfig saves data provided into the Config record. func (c *Config) Save(ctx appengine.Context) (err error) { if c.Key() == nil { ctx.Infof("Creating new config key") key := datastore.NewIncompleteKey(ctx, "Config", nil) c.SetKey(key) } else if err != nil { return } c.StandardOn = util.NormalizeTime(c.StandardOn) c.StandardOff = util.NormalizeTime(c.StandardOff) c.Timestamp = time.Now().Unix() _, err = datastore.Put(ctx, c.Key(), c) if err != nil { return fmt.Errorf("Error when putting: %v", err) } action.DeleteFor(c, ctx) return }