我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用werkzeug.__version__()。
def __init__(self, *args, **kwargs): super(FlaskClient, self).__init__(*args, **kwargs) self.environ_base = { "REMOTE_ADDR": "127.0.0.1", "HTTP_USER_AGENT": "werkzeug/" + werkzeug.__version__ }
def render_testapp(req): try: import pkg_resources except ImportError: eggs = () else: eggs = sorted(pkg_resources.working_set, key=lambda x: x.project_name.lower()) python_eggs = [] for egg in eggs: try: version = egg.version except (ValueError, AttributeError): version = 'unknown' python_eggs.append('<li>%s <small>[%s]</small>' % ( escape(egg.project_name), escape(version) )) wsgi_env = [] sorted_environ = sorted(req.environ.items(), key=lambda x: repr(x[0]).lower()) for key, value in sorted_environ: wsgi_env.append('<tr><th>%s<td><code>%s</code>' % ( escape(str(key)), ' '.join(wrap(escape(repr(value)))) )) sys_path = [] for item, virtual, expanded in iter_sys_path(): class_ = [] if virtual: class_.append('virtual') if expanded: class_.append('exp') sys_path.append('<li%s>%s' % ( class_ and ' class="%s"' % ' '.join(class_) or '', escape(item) )) return (TEMPLATE % { 'python_version': '<br>'.join(escape(sys.version).splitlines()), 'platform': escape(sys.platform), 'os': escape(os.name), 'api_version': sys.api_version, 'byteorder': sys.byteorder, 'werkzeug_version': werkzeug.__version__, 'python_eggs': '\n'.join(python_eggs), 'wsgi_env': '\n'.join(wsgi_env), 'sys_path': '\n'.join(sys_path) }).encode('utf-8')