diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-07-26 00:24:27 -0400 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-07-26 00:24:27 -0400 |
commit | 8dd07c0ddd99ae626a1ec8c06f75f27fed51269f (patch) | |
tree | 261d3c9911dabc58c1ac54e4e36b3dee24d2032b /modules/auth/apiv1 | |
parent | 0a739cf9ac901f54484c34bba8322418dedb09b0 (diff) | |
download | gitea-8dd07c0ddd99ae626a1ec8c06f75f27fed51269f.tar.gz gitea-8dd07c0ddd99ae626a1ec8c06f75f27fed51269f.zip |
New UI merge in progress
Diffstat (limited to 'modules/auth/apiv1')
-rw-r--r-- | modules/auth/apiv1/miscellaneous.go | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/modules/auth/apiv1/miscellaneous.go b/modules/auth/apiv1/miscellaneous.go index 726a080147..30515eb861 100644 --- a/modules/auth/apiv1/miscellaneous.go +++ b/modules/auth/apiv1/miscellaneous.go @@ -5,13 +5,12 @@ package apiv1 import ( - "net/http" "reflect" - "github.com/go-martini/martini" + "github.com/Unknwon/macaron" + "github.com/macaron-contrib/i18n" "github.com/gogits/gogs/modules/auth" - "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/middleware/binding" ) @@ -22,17 +21,16 @@ type MarkdownForm struct { Context string `form:"context"` } -func (f *MarkdownForm) Validate(errs *binding.Errors, req *http.Request, ctx martini.Context) { - data := ctx.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData) - validateApiReq(errs, data, f) +func (f *MarkdownForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) { + validateApiReq(errs, ctx.Data, f, l) } -func validateApiReq(errs *binding.Errors, data base.TmplData, f interface{}) { +func validateApiReq(errs *binding.Errors, data map[string]interface{}, f interface{}, l i18n.Locale) { if errs.Count() == 0 { return } else if len(errs.Overall) > 0 { for _, err := range errs.Overall { - log.Error("%s: %v", reflect.TypeOf(f), err) + log.Error(4, "%s: %v", reflect.TypeOf(f), err) } return } |