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
ce332713
Commit
ce332713
authored
Dec 20, 2013
by
傅小黑
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gofmt commented go files
parent
b459cf23
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
+10
-10
app.go
app.go
+1
-1
config.go
config.go
+1
-1
controller.go
controller.go
+8
-8
No files found.
app.go
View file @
ce332713
...
...
@@ -10,7 +10,7 @@ import (
"github.com/astaxie/beego/context"
)
// Fi
tl
erFunc defines filter function type.
// Fi
lt
erFunc defines filter function type.
type
FilterFunc
func
(
*
context
.
Context
)
// App defines beego application with a new PatternServeMux.
...
...
config.go
View file @
ce332713
...
...
@@ -127,7 +127,7 @@ func init() {
UseFcgi
=
false
MaxMemory
=
1
<<
26
//64MB
MaxMemory
=
1
<<
26
//64MB
EnableGzip
=
false
...
...
controller.go
View file @
ce332713
...
...
@@ -144,15 +144,15 @@ func (c *Controller) RenderBytes() ([]byte, error) {
//if the controller has set layout, then first get the tplname's content set the content to the layout
if
c
.
Layout
!=
""
{
if
c
.
TplNames
==
""
{
c
.
TplNames
=
strings
.
ToLower
(
c
.
controllerName
)
+
"/"
+
strings
.
ToLower
(
c
.
actionName
)
+
"."
+
c
.
TplExt
c
.
TplNames
=
strings
.
ToLower
(
c
.
controllerName
)
+
"/"
+
strings
.
ToLower
(
c
.
actionName
)
+
"."
+
c
.
TplExt
}
if
RunMode
==
"dev"
{
BuildTemplate
(
ViewsPath
)
}
newbytes
:=
bytes
.
NewBufferString
(
""
)
if
_
,
ok
:=
BeeTemplates
[
c
.
TplNames
];
!
ok
{
panic
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
return
[]
byte
{},
errors
.
New
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
panic
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
return
[]
byte
{},
errors
.
New
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
}
err
:=
BeeTemplates
[
c
.
TplNames
]
.
ExecuteTemplate
(
newbytes
,
c
.
TplNames
,
c
.
Data
)
if
err
!=
nil
{
...
...
@@ -171,15 +171,15 @@ func (c *Controller) RenderBytes() ([]byte, error) {
return
icontent
,
nil
}
else
{
if
c
.
TplNames
==
""
{
c
.
TplNames
=
strings
.
ToLower
(
c
.
controllerName
)
+
"/"
+
strings
.
ToLower
(
c
.
actionName
)
+
"."
+
c
.
TplExt
c
.
TplNames
=
strings
.
ToLower
(
c
.
controllerName
)
+
"/"
+
strings
.
ToLower
(
c
.
actionName
)
+
"."
+
c
.
TplExt
}
if
RunMode
==
"dev"
{
BuildTemplate
(
ViewsPath
)
}
ibytes
:=
bytes
.
NewBufferString
(
""
)
if
_
,
ok
:=
BeeTemplates
[
c
.
TplNames
];
!
ok
{
panic
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
return
[]
byte
{},
errors
.
New
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
panic
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
return
[]
byte
{},
errors
.
New
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
}
err
:=
BeeTemplates
[
c
.
TplNames
]
.
ExecuteTemplate
(
ibytes
,
c
.
TplNames
,
c
.
Data
)
if
err
!=
nil
{
...
...
@@ -219,7 +219,7 @@ func (c *Controller) UrlFor(endpoint string, values ...string) string {
return
""
}
if
endpoint
[
0
]
==
'.'
{
return
UrlFor
(
reflect
.
Indirect
(
reflect
.
ValueOf
(
c
.
AppController
))
.
Type
()
.
Name
()
+
endpoint
,
values
...
)
return
UrlFor
(
reflect
.
Indirect
(
reflect
.
ValueOf
(
c
.
AppController
))
.
Type
()
.
Name
()
+
endpoint
,
values
...
)
}
else
{
return
UrlFor
(
endpoint
,
values
...
)
}
...
...
@@ -327,7 +327,7 @@ func (c *Controller) SaveToFile(fromfile, tofile string) error {
return
err
}
defer
file
.
Close
()
f
,
err
:=
os
.
OpenFile
(
tofile
,
os
.
O_WRONLY
|
os
.
O_CREATE
|
os
.
O_TRUNC
,
0666
)
f
,
err
:=
os
.
OpenFile
(
tofile
,
os
.
O_WRONLY
|
os
.
O_CREATE
|
os
.
O_TRUNC
,
0666
)
if
err
!=
nil
{
return
err
}
...
...
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