MCPcopy
hub / github.com/writefreely/writefreely / Page

Method Page

handle.go:379–394  ·  view source on GitHub ↗
(n string)

Source from the content-addressed store, hash-verified

377}
378
379func (h *Handler) Page(n string) http.HandlerFunc {
380 return h.Web(func(app *App, w http.ResponseWriter, r *http.Request) error {
381 t, ok := pages[n]
382 if !ok {
383 return impart.HTTPError{http.StatusNotFound, "Page not found."}
384 }
385
386 sp := pageForReq(app, r)
387
388 err := t.ExecuteTemplate(w, "base", sp)
389 if err != nil {
390 log.Error("Unable to render page: %v", err)
391 }
392 return err
393 }, UserLevelOptional)
394}
395
396func (h *Handler) WebErrors(f handlerFunc, ul UserLevelFunc) http.HandlerFunc {
397 return func(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 2

WebMethod · 0.95
pageForReqFunction · 0.85

Tested by

no test coverage detected