|
|
@ -75,6 +75,16 @@ type Context struct {
|
|
|
|
Package *Package
|
|
|
|
Package *Package
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Close frees all resources hold by Context
|
|
|
|
|
|
|
|
func (ctx *Context) Close() error {
|
|
|
|
|
|
|
|
var err error
|
|
|
|
|
|
|
|
if ctx.Req != nil && ctx.Req.MultipartForm != nil {
|
|
|
|
|
|
|
|
err = ctx.Req.MultipartForm.RemoveAll() // remove the temp files buffered to tmp directory
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: close opened repo, and more
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// TrHTMLEscapeArgs runs Tr but pre-escapes all arguments with html.EscapeString.
|
|
|
|
// TrHTMLEscapeArgs runs Tr but pre-escapes all arguments with html.EscapeString.
|
|
|
|
// This is useful if the locale message is intended to only produce HTML content.
|
|
|
|
// This is useful if the locale message is intended to only produce HTML content.
|
|
|
|
func (ctx *Context) TrHTMLEscapeArgs(msg string, args ...string) string {
|
|
|
|
func (ctx *Context) TrHTMLEscapeArgs(msg string, args ...string) string {
|
|
|
@ -693,6 +703,8 @@ func Contexter() func(next http.Handler) http.Handler {
|
|
|
|
"RunModeIsProd": setting.IsProd,
|
|
|
|
"RunModeIsProd": setting.IsProd,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
defer ctx.Close()
|
|
|
|
|
|
|
|
|
|
|
|
// PageData is passed by reference, and it will be rendered to `window.config.pageData` in `head.tmpl` for JavaScript modules
|
|
|
|
// PageData is passed by reference, and it will be rendered to `window.config.pageData` in `head.tmpl` for JavaScript modules
|
|
|
|
ctx.PageData = map[string]interface{}{}
|
|
|
|
ctx.PageData = map[string]interface{}{}
|
|
|
|
ctx.Data["PageData"] = ctx.PageData
|
|
|
|
ctx.Data["PageData"] = ctx.PageData
|
|
|
|