Fix django view engine and context.ViewData

Former-commit-id: e16a9ef0241f83c4b9a7ebd3b5b7663b33fb070a
This commit is contained in:
kataras 2017-06-05 03:27:35 +03:00
parent 4013577c53
commit a2df3c9740
5 changed files with 2543 additions and 732 deletions

View File

@ -32,7 +32,6 @@ import (
"github.com/kataras/iris/core/errors"
"github.com/kataras/iris/sessions"
"github.com/kataras/iris/view"
)
type (
@ -1484,14 +1483,14 @@ func (ctx *context) Gzip(enable bool) {
const (
// NoLayout to disable layout for a particular template file
NoLayout = view.NoLayout
NoLayout = "iris.nolayout"
)
// ViewLayout sets the "layout" option if and when .View
// is being called afterwards, in the same request.
// Useful when need to set or/and change a layout based on the previous handlers in the chain.
//
// Note that the 'layoutTmplFile' argument can be setted to iris.NoLayout || view.NoLayout
// Note that the 'layoutTmplFile' argument can be setted to iris.NoLayout || view.NoLayout || context.NoLayout
// to disable the layout for a specific view render action,
// it disables the engine's configuration's layout property.
//

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

19
iris.go
View File

@ -38,14 +38,19 @@ const (
|_____|_| |_||___/ `
// Version is the current version number of the Iris Web framework.
Version = "V7.0.0"
Version = "7.0.0"
)
// MethodNone is a Virtual method
// to store the "offline" routes.
//
// Conversion for router.MethodNone.
const MethodNone = router.MethodNone
const (
// MethodNone is a Virtual method
// to store the "offline" routes.
//
// Conversion for router.MethodNone.
MethodNone = router.MethodNone
// NoLayout to disable layout for a particular template file
// Conversion for view.NoLayout
NoLayout = "iris.nolayout"
)
// Application is responsible to manage the state of the application.
// It contains and handles all the necessary parts to create a fast web server.
@ -198,7 +203,7 @@ func (app *Application) NewHost(srv *http.Server) *host.Supervisor {
if !app.config.DisableBanner {
// show the banner and the available keys to exit from app.
su.Schedule(host.WriteBannerTask(app.logger, banner+Version))
su.Schedule(host.WriteBannerTask(app.logger, banner+"V"+Version))
}
// give 5 seconds to the server to wait for the (idle) connections.

View File

@ -14,6 +14,7 @@ import (
"sync"
"github.com/flosch/pongo2"
"github.com/kataras/iris/context"
)
type (
@ -269,6 +270,10 @@ func getPongoContext(templateData interface{}) pongo2.Context {
return contextData
}
if contextData, isContextViewData := templateData.(context.Map); isContextViewData {
return pongo2.Context(contextData)
}
return templateData.(map[string]interface{})
}