1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-18 18:17:03 +00:00

Added partial templates

mailbox/list now renders
This commit is contained in:
James Hillyerd
2012-10-21 12:42:54 -07:00
parent 9c94bb2ab1
commit 71bb52a64a
17 changed files with 238 additions and 147 deletions

View File

@@ -1,12 +1,16 @@
package web
import (
"github.com/gorilla/mux"
"github.com/gorilla/sessions"
"github.com/jhillyerd/inbucket"
"net/http"
)
type Context struct {
Session *sessions.Session
Vars map[string]string
Session *sessions.Session
DataStore *inbucket.DataStore
}
func (c *Context) Close() {
@@ -14,9 +18,13 @@ func (c *Context) Close() {
}
func NewContext(req *http.Request) (*Context, error) {
vars := mux.Vars(req)
sess, err := sessionStore.Get(req, "inbucket")
ds := inbucket.NewDataStore()
ctx := &Context{
Session: sess,
Vars: vars,
Session: sess,
DataStore: ds,
}
if err != nil {
return ctx, err