Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
ea3d0690
Commit
ea3d0690
authored
Apr 29, 2017
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
golint
parent
1c32c011
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
7 deletions
+8
-7
policy.go
policy.go
+2
-2
template.go
template.go
+1
-0
template_test.go
template_test.go
+2
-2
templatefunc.go
templatefunc.go
+3
-3
No files found.
policy.go
View file @
ea3d0690
...
...
@@ -23,7 +23,7 @@ import (
// PolicyFunc defines a policy function which is invoked before the controller handler is executed.
type
PolicyFunc
func
(
*
context
.
Context
)
// Find
Router
Find Router info for URL
// Find
Policy
Find Router info for URL
func
(
p
*
ControllerRegister
)
FindPolicy
(
cont
*
context
.
Context
)
[]
PolicyFunc
{
var
urlPath
=
cont
.
Input
.
URL
()
if
!
BConfig
.
RouterCaseSensitive
{
...
...
@@ -71,7 +71,7 @@ func (p *ControllerRegister) addToPolicy(method, pattern string, r ...PolicyFunc
}
}
// Register new policy in beego
//
Policy
Register new policy in beego
func
Policy
(
pattern
,
method
string
,
policy
...
PolicyFunc
)
{
BeeApp
.
Handlers
.
addToPolicy
(
method
,
pattern
,
policy
...
)
}
...
...
template.go
View file @
ea3d0690
...
...
@@ -365,6 +365,7 @@ func DelStaticPath(url string) *App {
return
BeeApp
}
// AddTemplateEngine add a new templatePreProcessor which support extension
func
AddTemplateEngine
(
extension
string
,
fn
templatePreProcessor
)
*
App
{
AddTemplateExt
(
extension
)
beeTemplateEngines
[
extension
]
=
fn
...
...
template_test.go
View file @
ea3d0690
...
...
@@ -159,7 +159,7 @@ var add = `{{ template "layout_blog.tpl" . }}
<script src="/static/js/current.js"></script>
{{ end}}`
var
layout
_b
log
=
`<!DOCTYPE html>
var
layout
B
log
=
`<!DOCTYPE html>
<html>
<head>
<title>Lin Li</title>
...
...
@@ -231,7 +231,7 @@ func TestTemplateLayout(t *testing.T) {
if
k
==
0
{
f
.
WriteString
(
add
)
}
else
if
k
==
1
{
f
.
WriteString
(
layout
_b
log
)
f
.
WriteString
(
layout
B
log
)
}
f
.
Close
()
}
...
...
templatefunc.go
View file @
ea3d0690
...
...
@@ -507,9 +507,9 @@ func parseFormTag(fieldT reflect.StructField) (label, name, fType string, id str
class
=
fieldT
.
Tag
.
Get
(
"class"
)
required
=
false
required
_f
ield
:=
fieldT
.
Tag
.
Get
(
"required"
)
if
required
_field
!=
"-"
&&
required_f
ield
!=
""
{
required
,
_
=
strconv
.
ParseBool
(
required
_f
ield
)
required
F
ield
:=
fieldT
.
Tag
.
Get
(
"required"
)
if
required
Field
!=
"-"
&&
requiredF
ield
!=
""
{
required
,
_
=
strconv
.
ParseBool
(
required
F
ield
)
}
switch
len
(
tags
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment