Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f594750

Browse filesBrowse files
committed
Merge remote-tracking branch 'main/develop' into template-engine
# Conflicts: # results.go # revel.go
2 parents 48f08d6 + eacd8f4 commit f594750
Copy full SHA for f594750

14 files changed

+66
-60
lines changed

‎CONTRIBUTING.md

Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ you have a validated your ideas with other community members)!
7777
In order to have your pull requests accepted, we recommend you make your changes to Revel on a
7878
new git branch. For example,
7979
```
80-
$ git checkout -b feature/useful-new-thing develop # Create a new branch based on develop and switch to it
81-
$ ... # Make your changes and commit them
82-
$ git push fork develop # After new commits, push to your fork
80+
$ git checkout -b feature/useful-new-thing origin/develop # Create a new branch based on develop and switch to it
81+
$ ... # Make your changes and commit them
82+
$ git push fork feature/useful-new-thing # After new commits, push to your fork
8383
```
8484

8585
### Format Your Code

‎README.md

Copy file name to clipboardExpand all lines: README.md
+9-17Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
A high productivity, full-stack web framework for the [Go language](http://www.golang.org).
66

7-
Current Version: 0.13.1 (2016-06-06)
7+
Current Version: 0.14.0 (2017-03-24)
88

99
**As of Revel 0.13.0, Go 1.4+ is required.**
1010

@@ -21,6 +21,13 @@ Create a new app and run it:
2121

2222
Open http://localhost:9000 in your browser and you should see "It works!"
2323

24+
25+
## Community
26+
27+
* [Gitter](https://gitter.im/revel/community)
28+
* [StackOverflow](http://stackoverflow.com/questions/tagged/revel)
29+
* [Google Groups](https://groups.google.com/forum/#!forum/revel-framework)
30+
2431
## Learn More
2532

2633
* [Manual, Samples, Godocs, etc](http://revel.github.io)
@@ -32,33 +39,18 @@ Open http://localhost:9000 in your browser and you should see "It works!"
3239
* [Contributing Code Guidelines](https://github.com/revel/revel/blob/master/CONTRIBUTING.md)
3340
* [Revel Contributors](https://github.com/revel/revel/graphs/contributors)
3441

35-
## Community
36-
37-
Join on [StackOverflow](http://stackoverflow.com/questions/tagged/revel), [IRC #revel](http://webchat.freenode.net/?channels=%23revel&uio=d4) and [Google Groups](https://groups.google.com/forum/#!forum/revel-framework)
38-
39-
* Report bugs [here](https://github.com/revel/revel/issues)
40-
* Answer questions of other community members (via [StackOverflow](http://stackoverflow.com/questions/tagged/revel), [Google Groups](https://groups.google.com/forum/#!forum/revel-framework) and [IRC](http://webchat.freenode.net/?channels=%23revel&uio=d4))
41-
* Give feedback on new feature discussions (via [GitHub Issues](https://github.com/revel/revel/issues) and [Google Groups](https://groups.google.com/forum/#!forum/revel-framework))
42-
* Propose your own ideas via [Google Groups](https://groups.google.com/forum/#!forum/revel-framework)
43-
4442

4543
## Gratitude
4644

4745
First and foremost, we'd like to thank the growing community of developers who enjoy using and contributing to Revel. Your patience, feedback, and moral support are vital to the ongoing development of Revel!
4846

49-
Also, thank you to those who have increased their level of involvement with Revel and revitalized the momentum of Revel:
50-
* [Jeeva](https://github.com/jeevatkm)
51-
* [Pedro](https://github.com/pedromorgan)
52-
* Many others who provided valuable Pull Requests, testing, and feedback.
53-
5447
Finally, we'd like to thank the professional organizations that have supported the development of Revel:
5548
* [Looking Glass](https://www.lookingglasscyber.com/)
56-
* [Surge](http://surgeforward.com/)
5749

5850

5951
## Announcements
6052

61-
View the [v0.13.0 release notes](https://github.com/revel/revel/releases/tag/v0.13.0)
53+
View the [v0.14.0 release notes](https://github.com/revel/revel/releases/tag/v0.14.0)
6254
for all of the relevant changes.
6355

6456
We are working on increasing the speed and quality of our releases. Your feedback has never been so valuable, please share your thoughts with us and help shape Revel!

‎binder.go

Copy file name to clipboardExpand all lines: binder.go
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,12 @@ var (
153153

154154
PointerBinder = Binder{
155155
Bind: func(params *Params, name string, typ reflect.Type) reflect.Value {
156-
return Bind(params, name, typ.Elem()).Addr()
156+
v := Bind(params, name, typ.Elem())
157+
if v.CanAddr() {
158+
return v.Addr()
159+
}
160+
161+
return v
157162
},
158163
Unbind: func(output map[string]string, name string, val interface{}) {
159164
Unbind(output, name, reflect.ValueOf(val).Elem().Interface())

‎controller.go

Copy file name to clipboardExpand all lines: controller.go
+12-12Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type Controller struct {
3636
Session Session // Session, stored in cookie, signed.
3737
Params *Params // Parameters from URL and form (including multipart).
3838
Args map[string]interface{} // Per-request scratch space.
39-
RenderArgs map[string]interface{} // Args passed to the template.
39+
ViewArgs map[string]interface{} // Variables passed to the template.
4040
Validation *Validation // Data validation helpers
4141
}
4242

@@ -47,7 +47,7 @@ func NewController(req *Request, resp *Response) *Controller {
4747
Response: resp,
4848
Params: new(Params),
4949
Args: map[string]interface{}{},
50-
RenderArgs: map[string]interface{}{
50+
ViewArgs: map[string]interface{}{
5151
"RunMode": RunMode,
5252
"DevMode": DevMode,
5353
},
@@ -69,7 +69,7 @@ func (c *Controller) SetCookie(cookie *http.Cookie) {
6969
func (c *Controller) RenderError(err error) Result {
7070
c.setStatusIfNil(http.StatusInternalServerError)
7171

72-
return ErrorResult{c.RenderArgs, err}
72+
return ErrorResult{c.ViewArgs, err}
7373
}
7474

7575
func (c *Controller) setStatusIfNil(status int) {
@@ -79,7 +79,7 @@ func (c *Controller) setStatusIfNil(status int) {
7979
}
8080

8181
// Render a template corresponding to the calling Controller method.
82-
// Arguments will be added to c.RenderArgs prior to rendering the template.
82+
// Arguments will be added to c.ViewArgs prior to rendering the template.
8383
// They are keyed on their local identifier.
8484
//
8585
// For example:
@@ -91,7 +91,7 @@ func (c *Controller) setStatusIfNil(status int) {
9191
//
9292
// This action will render views/Users/ShowUser.html, passing in an extra
9393
// key-value "user": (User).
94-
func (c *Controller) Render(extraRenderArgs ...interface{}) Result {
94+
func (c *Controller) Render(extraViewArgs ...interface{}) Result {
9595
c.setStatusIfNil(http.StatusOK)
9696

9797
// Get the calling function name.
@@ -100,15 +100,15 @@ func (c *Controller) Render(extraRenderArgs ...interface{}) Result {
100100
ERROR.Println("Failed to get Caller information")
101101
}
102102

103-
// Get the extra RenderArgs passed in.
103+
// Get the extra ViewArgs passed in.
104104
if renderArgNames, ok := c.MethodType.RenderArgNames[line]; ok {
105-
if len(renderArgNames) == len(extraRenderArgs) {
106-
for i, extraRenderArg := range extraRenderArgs {
107-
c.RenderArgs[renderArgNames[i]] = extraRenderArg
105+
if len(renderArgNames) == len(extraViewArgs) {
106+
for i, extraRenderArg := range extraViewArgs {
107+
c.ViewArgs[renderArgNames[i]] = extraRenderArg
108108
}
109109
} else {
110110
ERROR.Println(len(renderArgNames), "RenderArg names found for",
111-
len(extraRenderArgs), "extra RenderArgs")
111+
len(extraViewArgs), "extra ViewArgs")
112112
}
113113
} else {
114114
ERROR.Println("No RenderArg names found for Render call on line", line,
@@ -119,7 +119,7 @@ func (c *Controller) Render(extraRenderArgs ...interface{}) Result {
119119
}
120120

121121
// RenderTemplate method does less magical way to render a template.
122-
// Renders the given template, using the current RenderArgs.
122+
// Renders the given template, using the current ViewArgs.
123123
func (c *Controller) RenderTemplate(templatePath string) Result {
124124
c.setStatusIfNil(http.StatusOK)
125125

@@ -131,7 +131,7 @@ func (c *Controller) RenderTemplate(templatePath string) Result {
131131

132132
return &RenderTemplateResult{
133133
Template: template,
134-
RenderArgs: c.RenderArgs,
134+
ViewArgs: c.ViewArgs,
135135
}
136136
}
137137

‎filterconfig.go

Copy file name to clipboardExpand all lines: filterconfig.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func newFilterConfigurator(controllerName, methodName string) FilterConfigurator
6666

6767
// FilterController returns a configurator for the filters applied to all
6868
// actions on the given controller instance. For example:
69-
// FilterAction(MyController{})
69+
// FilterController(MyController{})
7070
func FilterController(controllerInstance interface{}) FilterConfigurator {
7171
t := reflect.TypeOf(controllerInstance)
7272
for t.Kind() == reflect.Ptr {

‎flash.go

Copy file name to clipboardExpand all lines: flash.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (f Flash) Success(msg string, args ...interface{}) {
4545
// The name of the Flash cookie is set as CookiePrefix + "_FLASH".
4646
func FlashFilter(c *Controller, fc []Filter) {
4747
c.Flash = restoreFlash(c.Request.Request)
48-
c.RenderArgs["flash"] = c.Flash.Data
48+
c.ViewArgs["flash"] = c.Flash.Data
4949

5050
fc[0](c, fc[1:])
5151

‎i18n.go

Copy file name to clipboardExpand all lines: i18n.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func I18nFilter(c *Controller, fc []Filter) {
190190
// Set the current locale controller argument (CurrentLocaleControllerArg) with the given locale.
191191
func setCurrentLocaleControllerArguments(c *Controller, locale string) {
192192
c.Request.Locale = locale
193-
c.RenderArgs[CurrentLocaleRenderArg] = locale
193+
c.ViewArgs[CurrentLocaleRenderArg] = locale
194194
}
195195

196196
// Determine whether the given request has valid Accept-Language value.

‎invoker_test.go

Copy file name to clipboardExpand all lines: invoker_test.go
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func BenchmarkSetAction(b *testing.B) {
104104
RegisterController((*Mixin2)(nil), []*MethodType{{Name: "Method"}})
105105
RegisterController((*Benchmark)(nil), []*MethodType{{Name: "Method"}})
106106
c := Controller{
107-
RenderArgs: make(map[string]interface{}),
107+
ViewArgs: make(map[string]interface{}),
108108
}
109109

110110
for i := 0; i < b.N; i++ {
@@ -118,7 +118,7 @@ func BenchmarkSetAction(b *testing.B) {
118118
func BenchmarkInvoker(b *testing.B) {
119119
startFakeBookingApp()
120120
c := Controller{
121-
RenderArgs: make(map[string]interface{}),
121+
ViewArgs: make(map[string]interface{}),
122122
}
123123
if err := c.SetAction("Hotels", "Show"); err != nil {
124124
b.Errorf("Failed to set action: %s", err)

‎results.go

Copy file name to clipboardExpand all lines: results.go
+18-13Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright (c) 2012-2016 The Revel Framework Authors, All rights reserved.
2+
// Revel Framework source code and usage is governed by a MIT style
3+
// license that can be found in the LICENSE file.
4+
15
package revel
26

37
import (
@@ -10,7 +14,6 @@ import (
1014
"io/ioutil"
1115
"net/http"
1216
"reflect"
13-
"runtime/debug"
1417
"strconv"
1518
"strings"
1619
"time"
@@ -26,7 +29,7 @@ type Result interface {
2629
// It renders the relevant error page (errors/CODE.format, e.g. errors/500.json).
2730
// If RunMode is "dev", this results in a friendly error page.
2831
type ErrorResult struct {
29-
RenderArgs map[string]interface{}
32+
ViewArgs map[string]interface{}
3033
Error error
3134
}
3235

@@ -79,16 +82,16 @@ func (r ErrorResult) Apply(req *Request, resp *Response) {
7982
panic("no error provided")
8083
}
8184

82-
if r.RenderArgs == nil {
83-
r.RenderArgs = make(map[string]interface{})
85+
if r.ViewArgs == nil {
86+
r.ViewArgs = make(map[string]interface{})
8487
}
85-
r.RenderArgs["RunMode"] = RunMode
86-
r.RenderArgs["Error"] = revelError
87-
r.RenderArgs["Router"] = MainRouter
88+
r.ViewArgs["RunMode"] = RunMode
89+
r.ViewArgs["Error"] = revelError
90+
r.ViewArgs["Router"] = MainRouter
8891

8992
// Render it.
9093
var b bytes.Buffer
91-
err = tmpl.Render(&b, r.RenderArgs)
94+
err = tmpl.Render(&b, r.ViewArgs)
9295

9396
// If there was an error, print it in plain text.
9497
if err != nil {
@@ -108,6 +111,7 @@ func (r ErrorResult) Apply(req *Request, resp *Response) {
108111
ERROR.Println("Response WriteTo failed:", err)
109112
}
110113
}
114+
111115
}
112116

113117
type PlaintextErrorResult struct {
@@ -126,15 +130,16 @@ func (r PlaintextErrorResult) Apply(req *Request, resp *Response) {
126130
// a template be rendered.
127131
type RenderTemplateResult struct {
128132
Template Template
129-
RenderArgs map[string]interface{}
133+
ViewArgs map[string]interface{}
130134
}
131135

132136
func (r *RenderTemplateResult) Apply(req *Request, resp *Response) {
133137
// Handle panics when rendering templates.
134138
defer func() {
135139
if err := recover(); err != nil {
136-
PlaintextErrorResult{fmt.Errorf("Template Execution Panic in %s:\n%s\n\n%s",
137-
r.Template.Name(), err, string(debug.Stack()))}.Apply(req, resp)
140+
ERROR.Println(err)
141+
PlaintextErrorResult{fmt.Errorf("Template Execution Panic in %s:\n%s",
142+
r.Template.Name(), err)}.Apply(req, resp)
138143
}
139144
}()
140145

@@ -220,7 +225,7 @@ func (r *RenderTemplateResult) Apply(req *Request, resp *Response) {
220225
}
221226

222227
func (r *RenderTemplateResult) render(req *Request, resp *Response, wr io.Writer) {
223-
err := r.Template.Render(wr, r.RenderArgs)
228+
err := r.Template.Render(wr, r.ViewArgs)
224229
if err == nil {
225230
return
226231
}
@@ -247,7 +252,7 @@ func (r *RenderTemplateResult) render(req *Request, resp *Response, wr io.Writer
247252
}
248253
resp.Status = 500
249254
ERROR.Printf("Template Execution Error (in %s): %s", compileError.Path, compileError.Description)
250-
ErrorResult{r.RenderArgs, compileError}.Apply(req, resp)
255+
ErrorResult{r.ViewArgs, compileError}.Apply(req, resp)
251256
}
252257

253258
type RenderHTMLResult struct {

‎revel.go

Copy file name to clipboardExpand all lines: revel.go
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright (c) 2012-2016 The Revel Framework Authors, All rights reserved.
2+
// Revel Framework source code and usage is governed by a MIT style
3+
// license that can be found in the LICENSE file.
4+
15
package revel
26

37
import (
@@ -16,7 +20,8 @@ import (
1620
)
1721

1822
const (
19-
REVEL_TEMPLATE_ENGINES = "template.engines"
23+
// RevelImportPath Revel framework import path
24+
REVEL_TEMPLATE_ENGINES = "template.engines"
2025
RevelImportPath = "github.com/revel/revel"
2126
)
2227

@@ -199,7 +204,7 @@ func Init(mode, importPath, srcPath string) {
199204
AppRoot = Config.StringDefault("app.root", "")
200205
CookiePrefix = Config.StringDefault("cookie.prefix", "REVEL")
201206
CookieDomain = Config.StringDefault("cookie.domain", "")
202-
CookieSecure = Config.BoolDefault("cookie.secure", !DevMode)
207+
CookieSecure = Config.BoolDefault("cookie.secure", HTTPSsl)
203208
if secretStr := Config.StringDefault("app.secret", ""); secretStr != "" {
204209
secretKey = []byte(secretStr)
205210
}

‎session.go

Copy file name to clipboardExpand all lines: session.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func SessionFilter(c *Controller, fc []Filter) {
151151
sessionWasEmpty := len(c.Session) == 0
152152

153153
// Make session vars available in templates as {{.session.xyz}}
154-
c.RenderArgs["session"] = c.Session
154+
c.ViewArgs["session"] = c.Session
155155

156156
fc[0](c, fc[1:])
157157

‎testing/testsuite_test.go

Copy file name to clipboardExpand all lines: testing/testsuite_test.go
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ func TestGetCustom(t *testing.T) {
7676

7777
testSuite.AssertOk()
7878
testSuite.AssertContentType("application/json")
79-
testSuite.AssertHeader("Server", "gunicorn/19.7.0")
8079
testSuite.AssertContains("httpbin.org")
8180
testSuite.AssertContainsRegex("gzip|deflate")
8281
}

‎validation.go

Copy file name to clipboardExpand all lines: validation.go
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ func ValidationFilter(c *Controller, fc []Filter) {
194194

195195
fc[0](c, fc[1:])
196196

197-
// Add Validation errors to RenderArgs.
198-
c.RenderArgs["errors"] = c.Validation.ErrorMap()
197+
// Add Validation errors to ViewArgs.
198+
c.ViewArgs["errors"] = c.Validation.ErrorMap()
199199

200200
// Store the Validation errors
201201
var errorsValue string

‎version.go

Copy file name to clipboardExpand all lines: version.go
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
// Copyright (c) 2012-2016 The Revel Framework Authors, All rights reserved.
1+
// Copyright (c) 2012-2017 The Revel Framework Authors, All rights reserved.
22
// Revel Framework source code and usage is governed by a MIT style
33
// license that can be found in the LICENSE file.
44

55
package revel
66

77
const (
88
// Version current Revel version
9-
Version = "0.14.0-dev"
9+
Version = "0.14.0"
1010

1111
// BuildDate latest commit/release date
12-
BuildDate = "TBD"
12+
BuildDate = "2017-03-24"
1313

1414
// MinimumGoVersion minimum required Go version for Revel
1515
MinimumGoVersion = ">= go1.4"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.