mirror of
https://github.com/kataras/iris.git
synced 2025-02-02 15:30:36 +01:00
🎄 Merry Christmas everyone
minor fixes
This commit is contained in:
parent
e213dba0d3
commit
62a1829cb9
|
@ -44,6 +44,14 @@ type (
|
||||||
//
|
//
|
||||||
// Example: https://github.com/kataras/iris/blob/master/_examples/request-body/read-custom-via-unmarshaler/main.go
|
// Example: https://github.com/kataras/iris/blob/master/_examples/request-body/read-custom-via-unmarshaler/main.go
|
||||||
UnmarshalerFunc = context.UnmarshalerFunc
|
UnmarshalerFunc = context.UnmarshalerFunc
|
||||||
|
// DecodeFunc is a generic type of decoder function.
|
||||||
|
// When the returned error is not nil the decode operation
|
||||||
|
// is terminated and the error is received by the ReadJSONStream method,
|
||||||
|
// otherwise it continues to read the next available object.
|
||||||
|
// Look the `Context.ReadJSONStream` method.
|
||||||
|
//
|
||||||
|
// Example: https://github.com/kataras/iris/blob/master/_examples/request-body/read-json-stream.
|
||||||
|
DecodeFunc = context.DecodeFunc
|
||||||
// A Handler responds to an HTTP request.
|
// A Handler responds to an HTTP request.
|
||||||
// It writes reply headers and data to the Context.ResponseWriter() and then return.
|
// It writes reply headers and data to the Context.ResponseWriter() and then return.
|
||||||
// Returning signals that the request is finished;
|
// Returning signals that the request is finished;
|
||||||
|
|
|
@ -217,7 +217,7 @@ func (s *AmberEngine) executeTemplateBuf(name string, binding interface{}) (stri
|
||||||
tmpl := s.fromCache(name)
|
tmpl := s.fromCache(name)
|
||||||
if tmpl == nil {
|
if tmpl == nil {
|
||||||
s.bufPool.Put(buf)
|
s.bufPool.Put(buf)
|
||||||
return "", ErrNotExist{name, false, binding}
|
return "", ErrNotExist{Name: name, IsLayout: false, Data: binding}
|
||||||
}
|
}
|
||||||
|
|
||||||
err := tmpl.ExecuteTemplate(buf, name, binding)
|
err := tmpl.ExecuteTemplate(buf, name, binding)
|
||||||
|
@ -253,5 +253,5 @@ func (s *AmberEngine) ExecuteWriter(w io.Writer, filename string, layout string,
|
||||||
return tmpl.Execute(w, bindingData)
|
return tmpl.Execute(w, bindingData)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ErrNotExist{filename, false, bindingData}
|
return ErrNotExist{Name: filename, IsLayout: false, Data: bindingData}
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,5 +307,5 @@ func (s *DjangoEngine) ExecuteWriter(w io.Writer, filename string, _ string, bin
|
||||||
return tmpl.ExecuteWriter(getPongoContext(bindingData), w)
|
return tmpl.ExecuteWriter(getPongoContext(bindingData), w)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ErrNotExist{filename, false, bindingData}
|
return ErrNotExist{Name: filename, IsLayout: false, Data: bindingData}
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,7 +212,7 @@ func (s *HandlebarsEngine) ExecuteWriter(w io.Writer, filename string, layout st
|
||||||
if m, is := binding.(map[string]interface{}); is { // handlebars accepts maps,
|
if m, is := binding.(map[string]interface{}); is { // handlebars accepts maps,
|
||||||
context = m
|
context = m
|
||||||
} else {
|
} else {
|
||||||
return fmt.Errorf("Please provide a map[string]interface{} type as the binding instead of the %#v", binding)
|
return fmt.Errorf("please provide a map[string]interface{} type as the binding instead of the %#v", binding)
|
||||||
}
|
}
|
||||||
|
|
||||||
contents, err := s.executeTemplateBuf(filename, binding)
|
contents, err := s.executeTemplateBuf(filename, binding)
|
||||||
|
@ -235,5 +235,9 @@ func (s *HandlebarsEngine) ExecuteWriter(w io.Writer, filename string, layout st
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return ErrNotExist{fmt.Sprintf("%s (file: %s)", renderFilename, filename), false, bindingData}
|
return ErrNotExist{
|
||||||
|
Name: fmt.Sprintf("%s (file: %s)", renderFilename, filename),
|
||||||
|
IsLayout: false,
|
||||||
|
Data: bindingData,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -421,14 +421,14 @@ func (s *HTMLEngine) ExecuteWriter(w io.Writer, name string, layout string, bind
|
||||||
|
|
||||||
t := s.Templates.Lookup(name)
|
t := s.Templates.Lookup(name)
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return ErrNotExist{name, false, bindingData}
|
return ErrNotExist{Name: name, IsLayout: false, Data: bindingData}
|
||||||
}
|
}
|
||||||
s.runtimeFuncsFor(t, name, bindingData)
|
s.runtimeFuncsFor(t, name, bindingData)
|
||||||
|
|
||||||
if layout = getLayout(layout, s.layout); layout != "" {
|
if layout = getLayout(layout, s.layout); layout != "" {
|
||||||
lt := s.Templates.Lookup(layout)
|
lt := s.Templates.Lookup(layout)
|
||||||
if lt == nil {
|
if lt == nil {
|
||||||
return ErrNotExist{layout, true, bindingData}
|
return ErrNotExist{Name: layout, IsLayout: true, Data: bindingData}
|
||||||
}
|
}
|
||||||
|
|
||||||
s.layoutFuncsFor(lt, name, bindingData)
|
s.layoutFuncsFor(lt, name, bindingData)
|
||||||
|
|
|
@ -79,7 +79,7 @@ func (v *View) AddFunc(funcName string, funcBody interface{}) {
|
||||||
// Load compiles all the registered engines.
|
// Load compiles all the registered engines.
|
||||||
func (v *View) Load() error {
|
func (v *View) Load() error {
|
||||||
if !v.Registered() {
|
if !v.Registered() {
|
||||||
return fmt.Errorf("No engine is registered")
|
return fmt.Errorf("no engine was registered")
|
||||||
}
|
}
|
||||||
return v.Engine.Load()
|
return v.Engine.Load()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user