[Use new util modules in demo. bjorn@bringert.net**20060423162236] { hunk ./Hawl/Util/CGI.hs 5 +import Control.Monad (liftM) hunk ./Hawl/Util/CGI.hs 10 + +-- +-- * Inputs +-- + +getManyInputs :: [String] -> CGI (Maybe [String]) +getManyInputs = liftM sequence . mapM getInput + +-- +-- * Error handling +-- hunk ./examples/demo.hs 12 +import Hawl.Util.CGI +import Hawl.Util.XHtml hunk ./examples/demo.hs 18 - --- --- * CGI utilities --- - -getManyInputs :: [String] -> CGI (Maybe [String]) -getManyInputs = liftM sequence . mapM getInput - -cgiErrorHandler :: Exception -> CGI CGIResult -cgiErrorHandler e = - do - setHeader "Status" "500" - logCGI (show e) - output $ unlines ["
", - "" ++ show e ++ "
", - ""] - --- --- * XHTML utilities --- - -hlink :: HTML a => URL -> a -> Html -hlink u b = anchor ! [href u] << b - -mkHtml :: (HTML a,HTML b) => a -> b -> Html -mkHtml hdr bdy = (header << hdr) +++ (body << bdy) - }