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
54c89c0d
Commit
54c89c0d
authored
Dec 17, 2013
by
slene
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:astaxie/beego
parents
1c52f683
c3bc2bed
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
18 deletions
+23
-18
context.go
context/context.go
+0
-1
controller.go
controller.go
+23
-17
router.go
router.go
+0
-0
No files found.
context/context.go
View file @
54c89c0d
...
...
@@ -16,7 +16,6 @@ type Context struct {
func
(
ctx
*
Context
)
Redirect
(
status
int
,
localurl
string
)
{
ctx
.
Output
.
Header
(
"Location"
,
localurl
)
ctx
.
Output
.
SetStatus
(
status
)
ctx
.
Output
.
Body
([]
byte
(
" "
))
}
func
(
ctx
*
Context
)
Abort
(
status
int
,
body
string
)
{
...
...
controller.go
View file @
54c89c0d
...
...
@@ -24,22 +24,27 @@ import (
"github.com/astaxie/beego/session"
)
var
(
USERSTOPRUN
=
errors
.
New
(
"User stop run"
)
)
type
Controller
struct
{
Ctx
*
context
.
Context
Data
map
[
interface
{}]
interface
{}
ChildName
string
TplNames
string
Layout
string
TplExt
string
_xsrf_token
string
gotofunc
string
CruSession
session
.
SessionStore
XSRFExpire
int
AppController
interface
{}
Ctx
*
context
.
Context
Data
map
[
interface
{}]
interface
{}
controllerName
string
actionName
string
TplNames
string
Layout
string
TplExt
string
_xsrf_token
string
gotofunc
string
CruSession
session
.
SessionStore
XSRFExpire
int
AppController
interface
{}
}
type
ControllerInterface
interface
{
Init
(
ct
*
context
.
Context
,
c
hild
Name
string
,
app
interface
{})
Init
(
ct
*
context
.
Context
,
c
ontrollerName
,
action
Name
string
,
app
interface
{})
Prepare
()
Get
()
Post
()
...
...
@@ -52,11 +57,12 @@ type ControllerInterface interface {
Render
()
error
}
func
(
c
*
Controller
)
Init
(
ctx
*
context
.
Context
,
c
hild
Name
string
,
app
interface
{})
{
func
(
c
*
Controller
)
Init
(
ctx
*
context
.
Context
,
c
ontrollerName
,
action
Name
string
,
app
interface
{})
{
c
.
Data
=
make
(
map
[
interface
{}]
interface
{})
c
.
Layout
=
""
c
.
TplNames
=
""
c
.
ChildName
=
childName
c
.
controllerName
=
controllerName
c
.
actionName
=
actionName
c
.
Ctx
=
ctx
c
.
TplExt
=
"tpl"
c
.
AppController
=
app
...
...
@@ -119,7 +125,7 @@ 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
=
c
.
ChildName
+
"/"
+
strings
.
ToLower
(
c
.
Ctx
.
Request
.
Method
)
+
"."
+
c
.
TplExt
c
.
TplNames
=
strings
.
ToLower
(
c
.
controllerName
)
+
"/"
+
strings
.
ToLower
(
c
.
actionName
)
+
"."
+
c
.
TplExt
}
if
RunMode
==
"dev"
{
BuildTemplate
(
ViewsPath
)
...
...
@@ -146,7 +152,7 @@ func (c *Controller) RenderBytes() ([]byte, error) {
return
icontent
,
nil
}
else
{
if
c
.
TplNames
==
""
{
c
.
TplNames
=
c
.
ChildName
+
"/"
+
strings
.
ToLower
(
c
.
Ctx
.
Request
.
Method
)
+
"."
+
c
.
TplExt
c
.
TplNames
=
strings
.
ToLower
(
c
.
controllerName
)
+
"/"
+
strings
.
ToLower
(
c
.
actionName
)
+
"."
+
c
.
TplExt
}
if
RunMode
==
"dev"
{
BuildTemplate
(
ViewsPath
)
...
...
@@ -181,7 +187,7 @@ func (c *Controller) Abort(code string) {
}
func
(
c
*
Controller
)
StopRun
()
{
panic
(
""
)
panic
(
USERSTOPRUN
)
}
func
(
c
*
Controller
)
UrlFor
(
endpoint
string
,
values
...
string
)
string
{
...
...
router.go
View file @
54c89c0d
This diff is collapsed.
Click to expand it.
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