Skip to content

Commit

Permalink
Change code structure
Browse files Browse the repository at this point in the history
  • Loading branch information
leetaifook committed Jan 11, 2013
1 parent 7d1c6f4 commit 32a131c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions web/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ func (p *Page) Init(w http.ResponseWriter, r *http.Request) {
p.GET = p.site.base.getHttpGet(r)
p.POST = p.site.base.getHttpPost(r, p.MAX_FORM_SIZE)
p.COOKIE = p.site.base.getHttpCookie(r)
}

func (p *Page) initModule(w http.ResponseWriter, r *http.Request) {
if p.site.supportSession {
switch p.Config.SessionType {
case "file":
Expand All @@ -129,6 +132,8 @@ func (p *Page) Init(w http.ResponseWriter, r *http.Request) {

if p.site.supportI18n {
p.LANG = func() map[string]string {
log.Debug("<Page.Init> ", `p.TARGET_LANG: `, p.TARGET_LANG)

if p.TARGET_LANG == "" {
p.TARGET_LANG = strings.TrimSpace(r.Header.Get("Accept-Language"))
if i := strings.Index(p.TARGET_LANG, ","); i != -1 {
Expand Down Expand Up @@ -535,6 +540,8 @@ func (p *Page) routeController(i interface{}, w http.ResponseWriter, r *http.Req
ppc.callMethod(tpc, vpc, "Init", rvr, rvw)
}

ppc.initModule(w, r)

if _, ok := tpc.MethodByName(ppc.CurrentAction); ok && ppc.filterMethod(ppc.CurrentAction) {
ppc.filterDoMethod(tpc, vpc, "Before_", rvr, rvw)
ppc.callMethod(tpc, vpc, "Before_"+ppc.CurrentAction, rvr, rvw)
Expand Down

0 comments on commit 32a131c

Please sign in to comment.