1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 07:20:55 +00:00

typo fixed

seperator => separator
This commit is contained in:
JessonChan 2016-01-15 14:07:37 +08:00
parent 0eaf923a27
commit 52083de720
6 changed files with 26 additions and 26 deletions

View File

@ -120,7 +120,7 @@ func listConf(rw http.ResponseWriter, r *http.Request) {
m["BConfig.WebConfig.AutoRender"] = BConfig.WebConfig.AutoRender m["BConfig.WebConfig.AutoRender"] = BConfig.WebConfig.AutoRender
m["BConfig.WebConfig.EnableDocs"] = BConfig.WebConfig.EnableDocs m["BConfig.WebConfig.EnableDocs"] = BConfig.WebConfig.EnableDocs
m["BConfig.WebConfig.FlashName"] = BConfig.WebConfig.FlashName m["BConfig.WebConfig.FlashName"] = BConfig.WebConfig.FlashName
m["BConfig.WebConfig.FlashSeperator"] = BConfig.WebConfig.FlashSeperator m["BConfig.WebConfig.FlashSeparator"] = BConfig.WebConfig.FlashSeparator
m["BConfig.WebConfig.DirectoryIndex"] = BConfig.WebConfig.DirectoryIndex m["BConfig.WebConfig.DirectoryIndex"] = BConfig.WebConfig.DirectoryIndex
m["BConfig.WebConfig.StaticDir"] = BConfig.WebConfig.StaticDir m["BConfig.WebConfig.StaticDir"] = BConfig.WebConfig.StaticDir
m["BConfig.WebConfig.StaticExtensionsToGzip"] = BConfig.WebConfig.StaticExtensionsToGzip m["BConfig.WebConfig.StaticExtensionsToGzip"] = BConfig.WebConfig.StaticExtensionsToGzip
@ -128,7 +128,7 @@ func listConf(rw http.ResponseWriter, r *http.Request) {
m["BConfig.WebConfig.TemplateRight"] = BConfig.WebConfig.TemplateRight m["BConfig.WebConfig.TemplateRight"] = BConfig.WebConfig.TemplateRight
m["BConfig.WebConfig.ViewsPath"] = BConfig.WebConfig.ViewsPath m["BConfig.WebConfig.ViewsPath"] = BConfig.WebConfig.ViewsPath
m["BConfig.WebConfig.EnableXSRF"] = BConfig.WebConfig.EnableXSRF m["BConfig.WebConfig.EnableXSRF"] = BConfig.WebConfig.EnableXSRF
m["BConfig.WebConfig.XSRFKEY"] = BConfig.WebConfig.XSRFKEY m["BConfig.WebConfig.XSRFKEY"] = BConfig.WebConfig.XSRFKey
m["BConfig.WebConfig.XSRFExpire"] = BConfig.WebConfig.XSRFExpire m["BConfig.WebConfig.XSRFExpire"] = BConfig.WebConfig.XSRFExpire
m["BConfig.WebConfig.Session.SessionOn"] = BConfig.WebConfig.Session.SessionOn m["BConfig.WebConfig.Session.SessionOn"] = BConfig.WebConfig.Session.SessionOn
m["BConfig.WebConfig.Session.SessionProvider"] = BConfig.WebConfig.Session.SessionProvider m["BConfig.WebConfig.Session.SessionProvider"] = BConfig.WebConfig.Session.SessionProvider

View File

@ -63,7 +63,7 @@ type WebConfig struct {
AutoRender bool AutoRender bool
EnableDocs bool EnableDocs bool
FlashName string FlashName string
FlashSeperator string FlashSeparator string
DirectoryIndex bool DirectoryIndex bool
StaticDir map[string]string StaticDir map[string]string
StaticExtensionsToGzip []string StaticExtensionsToGzip []string
@ -71,7 +71,7 @@ type WebConfig struct {
TemplateRight string TemplateRight string
ViewsPath string ViewsPath string
EnableXSRF bool EnableXSRF bool
XSRFKEY string XSRFKey string
XSRFExpire int XSRFExpire int
Session SessionConfig Session SessionConfig
} }
@ -141,7 +141,7 @@ func init() {
AutoRender: true, AutoRender: true,
EnableDocs: false, EnableDocs: false,
FlashName: "BEEGO_FLASH", FlashName: "BEEGO_FLASH",
FlashSeperator: "BEEGOFLASH", FlashSeparator: "BEEGOFLASH",
DirectoryIndex: false, DirectoryIndex: false,
StaticDir: map[string]string{"/static": "static"}, StaticDir: map[string]string{"/static": "static"},
StaticExtensionsToGzip: []string{".css", ".js"}, StaticExtensionsToGzip: []string{".css", ".js"},
@ -149,7 +149,7 @@ func init() {
TemplateRight: "}}", TemplateRight: "}}",
ViewsPath: "views", ViewsPath: "views",
EnableXSRF: false, EnableXSRF: false,
XSRFKEY: "beegoxsrf", XSRFKey: "beegoxsrf",
XSRFExpire: 0, XSRFExpire: 0,
Session: SessionConfig{ Session: SessionConfig{
SessionOn: false, SessionOn: false,
@ -221,9 +221,9 @@ func ParseConfig() (err error) {
BConfig.WebConfig.ViewsPath = AppConfig.DefaultString("ViewsPath", BConfig.WebConfig.ViewsPath) BConfig.WebConfig.ViewsPath = AppConfig.DefaultString("ViewsPath", BConfig.WebConfig.ViewsPath)
BConfig.WebConfig.DirectoryIndex = AppConfig.DefaultBool("DirectoryIndex", BConfig.WebConfig.DirectoryIndex) BConfig.WebConfig.DirectoryIndex = AppConfig.DefaultBool("DirectoryIndex", BConfig.WebConfig.DirectoryIndex)
BConfig.WebConfig.FlashName = AppConfig.DefaultString("FlashName", BConfig.WebConfig.FlashName) BConfig.WebConfig.FlashName = AppConfig.DefaultString("FlashName", BConfig.WebConfig.FlashName)
BConfig.WebConfig.FlashSeperator = AppConfig.DefaultString("FlashSeperator", BConfig.WebConfig.FlashSeperator) BConfig.WebConfig.FlashSeparator = AppConfig.DefaultString("FlashSeparator", BConfig.WebConfig.FlashSeparator)
BConfig.WebConfig.EnableDocs = AppConfig.DefaultBool("EnableDocs", BConfig.WebConfig.EnableDocs) BConfig.WebConfig.EnableDocs = AppConfig.DefaultBool("EnableDocs", BConfig.WebConfig.EnableDocs)
BConfig.WebConfig.XSRFKEY = AppConfig.DefaultString("XSRFKEY", BConfig.WebConfig.XSRFKEY) BConfig.WebConfig.XSRFKey = AppConfig.DefaultString("XSRFKEY", BConfig.WebConfig.XSRFKey)
BConfig.WebConfig.EnableXSRF = AppConfig.DefaultBool("EnableXSRF", BConfig.WebConfig.EnableXSRF) BConfig.WebConfig.EnableXSRF = AppConfig.DefaultBool("EnableXSRF", BConfig.WebConfig.EnableXSRF)
BConfig.WebConfig.XSRFExpire = AppConfig.DefaultInt("XSRFExpire", BConfig.WebConfig.XSRFExpire) BConfig.WebConfig.XSRFExpire = AppConfig.DefaultInt("XSRFExpire", BConfig.WebConfig.XSRFExpire)
BConfig.WebConfig.TemplateLeft = AppConfig.DefaultString("TemplateLeft", BConfig.WebConfig.TemplateLeft) BConfig.WebConfig.TemplateLeft = AppConfig.DefaultString("TemplateLeft", BConfig.WebConfig.TemplateLeft)

View File

@ -29,12 +29,12 @@
// cnf.Int64(key string) (int64, error) // cnf.Int64(key string) (int64, error)
// cnf.Bool(key string) (bool, error) // cnf.Bool(key string) (bool, error)
// cnf.Float(key string) (float64, error) // cnf.Float(key string) (float64, error)
// cnf.DefaultString(key string, defaultval string) string // cnf.DefaultString(key string, defaultVal string) string
// cnf.DefaultStrings(key string, defaultval []string) []string // cnf.DefaultStrings(key string, defaultVal []string) []string
// cnf.DefaultInt(key string, defaultval int) int // cnf.DefaultInt(key string, defaultVal int) int
// cnf.DefaultInt64(key string, defaultval int64) int64 // cnf.DefaultInt64(key string, defaultVal int64) int64
// cnf.DefaultBool(key string, defaultval bool) bool // cnf.DefaultBool(key string, defaultVal bool) bool
// cnf.DefaultFloat(key string, defaultval float64) float64 // cnf.DefaultFloat(key string, defaultVal float64) float64
// cnf.DIY(key string) (interface{}, error) // cnf.DIY(key string) (interface{}, error)
// cnf.GetSection(section string) (map[string]string, error) // cnf.GetSection(section string) (map[string]string, error)
// cnf.SaveConfigFile(filename string) error // cnf.SaveConfigFile(filename string) error
@ -55,12 +55,12 @@ type Configer interface {
Int64(key string) (int64, error) Int64(key string) (int64, error)
Bool(key string) (bool, error) Bool(key string) (bool, error)
Float(key string) (float64, error) Float(key string) (float64, error)
DefaultString(key string, defaultval string) string // support section::key type in key string when using ini and json type; Int,Int64,Bool,Float,DIY are same. DefaultString(key string, defaultVal string) string // support section::key type in key string when using ini and json type; Int,Int64,Bool,Float,DIY are same.
DefaultStrings(key string, defaultval []string) []string //get string slice DefaultStrings(key string, defaultVal []string) []string //get string slice
DefaultInt(key string, defaultval int) int DefaultInt(key string, defaultVal int) int
DefaultInt64(key string, defaultval int64) int64 DefaultInt64(key string, defaultVal int64) int64
DefaultBool(key string, defaultval bool) bool DefaultBool(key string, defaultVal bool) bool
DefaultFloat(key string, defaultval float64) float64 DefaultFloat(key string, defaultVal float64) float64
DIY(key string) (interface{}, error) DIY(key string) (interface{}, error)
GetSection(section string) (map[string]string, error) GetSection(section string) (map[string]string, error)
SaveConfigFile(filename string) error SaveConfigFile(filename string) error

View File

@ -23,7 +23,7 @@ func TestDefaults(t *testing.T) {
t.Errorf("FlashName was not set to default.") t.Errorf("FlashName was not set to default.")
} }
if BConfig.WebConfig.FlashSeperator != "BEEGOFLASH" { if BConfig.WebConfig.FlashSeparator != "BEEGOFLASH" {
t.Errorf("FlashName was not set to default.") t.Errorf("FlashName was not set to default.")
} }
} }

View File

@ -595,7 +595,7 @@ func (c *Controller) XSRFToken() string {
if c.XSRFExpire > 0 { if c.XSRFExpire > 0 {
expire = int64(c.XSRFExpire) expire = int64(c.XSRFExpire)
} }
c._xsrfToken = c.Ctx.XSRFToken(BConfig.WebConfig.XSRFKEY, expire) c._xsrfToken = c.Ctx.XSRFToken(BConfig.WebConfig.XSRFKey, expire)
} }
return c._xsrfToken return c._xsrfToken
} }

View File

@ -83,7 +83,7 @@ func (fd *FlashData) Store(c *Controller) {
c.Data["flash"] = fd.Data c.Data["flash"] = fd.Data
var flashValue string var flashValue string
for key, value := range fd.Data { for key, value := range fd.Data {
flashValue += "\x00" + key + "\x23" + BConfig.WebConfig.FlashSeperator + "\x23" + value + "\x00" flashValue += "\x00" + key + "\x23" + BConfig.WebConfig.FlashSeparator + "\x23" + value + "\x00"
} }
c.Ctx.SetCookie(BConfig.WebConfig.FlashName, url.QueryEscape(flashValue), 0, "/") c.Ctx.SetCookie(BConfig.WebConfig.FlashName, url.QueryEscape(flashValue), 0, "/")
} }
@ -96,7 +96,7 @@ func ReadFromRequest(c *Controller) *FlashData {
vals := strings.Split(v, "\x00") vals := strings.Split(v, "\x00")
for _, v := range vals { for _, v := range vals {
if len(v) > 0 { if len(v) > 0 {
kv := strings.Split(v, "\x23"+BConfig.WebConfig.FlashSeperator+"\x23") kv := strings.Split(v, "\x23"+BConfig.WebConfig.FlashSeparator+"\x23")
if len(kv) == 2 { if len(kv) == 2 {
flash.Data[kv[0]] = kv[1] flash.Data[kv[0]] = kv[1]
} }