codecamp

Lint Validation Middleware

Lint Validation Middleware

0.5 新版功能.

This module provides a middleware that performs sanity checks of the WSGIapplication. It checks that PEP 333 is properly implemented and warnson some common HTTP errors such as non-empty responses for 304 statuscodes.

This module provides a middleware, the LintMiddleware. Wrap yourapplication with it and it will warn about common problems with WSGI andHTTP while your application is running.

It's strongly recommended to use it during development.

class werkzeug.contrib.lint.LintMiddleware(app)
This middleware wraps an application and warns on common errors.Among other thing it currently checks for the following problems:

  • invalid status codes
  • non-bytestrings sent to the WSGI server
  • strings returned from the WSGI application
  • non-empty conditional responses
  • unquoted etags
  • relative URLs in the Location header
  • unsafe calls to wsgi.input
  • unclosed iterators

Detected errors are emitted using the standard Python warnings system and usually end up on stderr.

from werkzeug.contrib.lint import LintMiddleware
app = LintMiddleware(app)
WSGI Application Profiler
Werkzeug Changelog
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }