1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-12 00:21:01 +00:00
This commit is contained in:
astaxie
2014-04-11 16:08:43 +08:00
parent 05e5baaa9f
commit 4245521660
24 changed files with 10 additions and 47 deletions

View File

@ -153,7 +153,6 @@ func (c *Controller) RenderBytes() ([]byte, error) {
newbytes := bytes.NewBufferString("")
if _, ok := BeeTemplates[c.TplNames]; !ok {
panic("can't find templatefile in the path:" + c.TplNames)
return []byte{}, errors.New("can't find templatefile in the path:" + c.TplNames)
}
err := BeeTemplates[c.TplNames].ExecuteTemplate(newbytes, c.TplNames, c.Data)
if err != nil {
@ -199,7 +198,6 @@ func (c *Controller) RenderBytes() ([]byte, error) {
ibytes := bytes.NewBufferString("")
if _, ok := BeeTemplates[c.TplNames]; !ok {
panic("can't find templatefile in the path:" + c.TplNames)
return []byte{}, errors.New("can't find templatefile in the path:" + c.TplNames)
}
err := BeeTemplates[c.TplNames].ExecuteTemplate(ibytes, c.TplNames, c.Data)
if err != nil {
@ -209,7 +207,6 @@ func (c *Controller) RenderBytes() ([]byte, error) {
icontent, _ := ioutil.ReadAll(ibytes)
return icontent, nil
}
return []byte{}, nil
}
// Redirect sends the redirection response to url with status code.
@ -243,7 +240,6 @@ func (c *Controller) UrlFor(endpoint string, values ...string) string {
} else {
return UrlFor(endpoint, values...)
}
return ""
}
// ServeJson sends a json response with encoding charset.