summaryrefslogtreecommitdiffstats
path: root/modules/middleware
diff options
context:
space:
mode:
Diffstat (limited to 'modules/middleware')
-rw-r--r--modules/middleware/context.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/middleware/context.go b/modules/middleware/context.go
index 200a74cb3a..2995d5788e 100644
--- a/modules/middleware/context.go
+++ b/modules/middleware/context.go
@@ -106,6 +106,12 @@ func (ctx *Context) HasError() bool {
return hasErr.(bool)
}
+// HasValue returns true if value of given name exists.
+func (ctx *Context) HasValue(name string) bool {
+ _, ok := ctx.Data[name]
+ return ok
+}
+
// HTML calls Context.HTML and converts template name to string.
func (ctx *Context) HTML(status int, name base.TplName) {
ctx.Context.HTML(status, string(name))
@@ -140,7 +146,7 @@ func (ctx *Context) Handle(status int, title string, err error) {
}
func (ctx *Context) HandleText(status int, title string) {
- if (status / 100 == 4) || (status / 100 == 5) {
+ if (status/100 == 4) || (status/100 == 5) {
log.Error(4, "%s", title)
}
ctx.RenderData(status, []byte(title))