コード例 #1
0
func (p paintings) convert(w http.ResponseWriter, c appengine.Context, cs categories, ms media) {
	for _, o := range p {
		old := o.Fields
		p := &painting.Painting{
			Object: object.New(
				painting.Kind,
				strconv.Itoa(old.Number),
			),
			Title: old.Title,
			Image: painting.Image{
				BlobKey: appengine.BlobKey(" "),
			},
			Description: old.Description,
			Year:        old.Year,
			Categories:  cs.convert(old.Categories),
			Media:       ms.convert(old.Medium),
			Price:       old.Price,
			Width:       old.Width,
			Height:      old.Height,
			ForSale:     old.Status == "F",
		}
		if old.Image != "" {
			p.Image.URL = baseURL + old.Image
		}
		saveLater.Call(c, p)
	}
}
コード例 #2
0
ファイル: painting.go プロジェクト: verticalpalette/dandubois
func Get(c appengine.Context, id ID) (*Painting, error) {
	p := Painting{
		Object: object.New(Kind, string(id)),
	}
	err := object.Get(c, &p)
	if err != nil {
		return nil, err
	}
	return &p, nil
}