Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL routing test that fails currently. #186

Closed
wants to merge 86 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
0f705da
Removed undocumented attribute
mitsuhiko Sep 29, 2011
409ed22
Removed dead reference
mitsuhiko Sep 29, 2011
c0999e7
Merge branch '0.8-maintenance'
mitsuhiko Sep 29, 2011
8e4fdae
Merge branch '0.8-maintenance'
mitsuhiko Sep 29, 2011
f6a0f63
Merge branch '0.8-maintenance'
mitsuhiko Sep 30, 2011
aa76943
Merge commit 'eb96c05'
mitsuhiko Oct 6, 2011
639f35b
Added support for tell() on the stream.
mitsuhiko Oct 6, 2011
c53d3fd
Moved a few generic asserts to assert_equal
mitsuhiko Oct 6, 2011
0732a7a
ETags now is truthy if it contains weak tags.
mitsuhiko Oct 9, 2011
97894b6
Work around an stdlib bug for SSL.
mitsuhiko Oct 11, 2011
2d66702
Improved SSL support and docs for it.
mitsuhiko Oct 11, 2011
7e0d6c4
Merge branch '0.8-maintenance'
mitsuhiko Oct 24, 2011
07d9f77
Merge branch '0.8-maintenance'
mitsuhiko Nov 2, 2011
01930a3
Merge branch '0.8-maintenance'
mitsuhiko Nov 2, 2011
4ca6e70
Refactored the test client's redirect support
mitsuhiko Nov 25, 2011
8981a03
Merge branch '0.8-maintenance'
Dec 4, 2011
d3b8a52
Merge branch '0.8-maintenance'
mitsuhiko Dec 13, 2011
e0bb9bc
Merge branch 'master' of github.com:mitsuhiko/werkzeug
mitsuhiko Dec 13, 2011
997196d
Merge branch '0.8-maintenance'
mitsuhiko Dec 16, 2011
3399455
Merge branch '0.8-maintenance'
mitsuhiko Dec 16, 2011
587ea82
Fixed a typo in the changelog
mitsuhiko Dec 16, 2011
3cbe355
Added tests for make_chunk_iter and added support for iterators inste…
mitsuhiko Dec 18, 2011
fc05a46
Merge branch '0.8-maintenance'
mitsuhiko Dec 18, 2011
284c12b
Merge branch '0.8-maintenance'
mitsuhiko Dec 18, 2011
806a032
Refactored make_line_iter
mitsuhiko Dec 19, 2011
6d57085
Merge branch '0.8-maintenance'
mitsuhiko Dec 19, 2011
c6c9442
Removed stray print
mitsuhiko Dec 19, 2011
7dc8959
Removed more test naming docstrings
mitsuhiko Dec 19, 2011
88c715a
No longer quote pluses in URL parts by the routing system. This fixe…
mitsuhiko Dec 27, 2011
8b8a41b
Do not quote percent sign when converting IRI to URI.
Dec 28, 2011
dccbdda
Dropped 2.4 support for the security module and added arbitrary algor…
mitsuhiko Dec 29, 2011
36dda6e
Fix s/savely/safely/ typo in quickstart guide.
jodal Dec 29, 2011
f1e24c2
Fix s/request/response/ error.
jodal Dec 29, 2011
39c6af6
Merge pull request #147 from vickenty/patch-1
mitsuhiko Jan 9, 2012
9452e62
Merge branch '0.8-maintenance'
mitsuhiko Jan 21, 2012
62409ac
Merge branch '0.8-maintenance'
mitsuhiko Jan 21, 2012
a5c7f3c
Merge branch '0.8-maintenance'
mitsuhiko Jan 24, 2012
c5a8754
fix small typo in docstring
plq Jan 26, 2012
9e50166
fix a few more small typos in MultipartParser
plq Jan 27, 2012
001e421
Merge branch '0.8-maintenance'
mitsuhiko Feb 5, 2012
50a4d58
Merge branch '0.8-maintenance'
mitsuhiko Feb 5, 2012
c5a6f36
Merge branch '0.8-maintenance'
mitsuhiko Feb 22, 2012
2b76504
Added 422 Unprocessable Entity exception, with tests
rclark72 Feb 24, 2012
1fad0fd
Merge branch '0.8-maintenance'
Feb 24, 2012
770ff21
Merge branch 'master' of https://github.com/lojack/werkzeug
Feb 24, 2012
34b22a5
Merge branch 'master' of https://github.com/plq/werkzeug
Feb 24, 2012
3e6338a
Merge branch 'patch-2' of https://github.com/jodal/werkzeug
Feb 24, 2012
ee699b7
Merge branch 'patch-1' of https://github.com/jodal/werkzeug
Feb 24, 2012
8eda3aa
spelling fix
Feb 24, 2012
ff86efd
Merge branch '0.8-maintenance'
Feb 24, 2012
6a2fd2c
Merge branch '0.8-maintenance'
Feb 24, 2012
f3b8516
Merge branch '0.8-maintenance'
mitsuhiko Mar 5, 2012
a867b2a
in debugger: store a reference to the last repr'd object in '_' for e…
wilsaj Mar 13, 2012
f34c9b9
Fix #127, doc typos
njl Mar 13, 2012
7019b65
Merge pull request #172 from njl/fix-issue-127
Mar 13, 2012
a4075e3
Merge branch '0.8-maintenance'
mitsuhiko Mar 27, 2012
84e719e
Merge branch '0.8-maintenance'
mitsuhiko Mar 27, 2012
ad5630c
Merge branch 'master' of github.com:mitsuhiko/werkzeug
mitsuhiko Mar 27, 2012
fc972cb
Merge branch '0.8-maintenance'
mitsuhiko Mar 27, 2012
a63f783
Merge branch '0.8-maintenance'
mitsuhiko Mar 27, 2012
9866e9d
Merge branch '0.8-maintenance'
mitsuhiko Mar 27, 2012
c57ac61
Add convenience method to access the full path.
nvie May 1, 2012
41d3e6c
Merge pull request #184 from nvie/master
May 1, 2012
61f2892
URL routing test that fails currently.
jace May 8, 2012
ba23ffb
Merge pull request #171 from wilsaj/debugger-keep-reference-to-last-r…
May 11, 2012
7238cb1
Made a tiny grammar fix to tutorial
adrianholovaty May 11, 2012
03a6348
Merge pull request #187 from adrianholovaty/doctweak
May 12, 2012
fe7633c
Removed a code example that I did not manage to get through rst.
mitsuhiko Jun 17, 2012
a2a58d0
update match_compare_key method with new heuristic
jasonLaster Jun 29, 2012
bf2119b
merge test_path and test_path_complex tests
jasonLaster Jun 29, 2012
0a3b95f
Fix the 'processes' comment which is a bit misleading.
Jul 3, 2012
92fcf0d
Merge branch 'master' of https://github.com/mitsuhiko/werkzeug into 0…
jace Jul 4, 2012
6f21882
Remove a duplicate line
SimonSapin Jul 19, 2012
5128769
Change the example in parse_options_header
SimonSapin Aug 1, 2012
08e0e08
contrib.atom: Fix empty author tag bug in FeedEntry.
dingens Aug 29, 2012
bcc0a33
Add support for the "category" element to feed entries
agateau Sep 20, 2012
47d041e
Merge pull request #217 from agateau/atom-categories
Sep 24, 2012
cf41e9d
Merge pull request #211 from maix/master
Sep 24, 2012
bc125b4
contrib.atom: Fix copy and paste error in docstring.
dingens Oct 24, 2012
a5d2883
Merge pull request #227 from maix/master
Oct 24, 2012
3f1206e
Merge pull request #208 from SimonSapin/patch-4
Oct 24, 2012
0c89136
Merge pull request #202 from SimonSapin/patch-1
Oct 24, 2012
105996c
Fixed an error with openssl serving
mitsuhiko Oct 26, 2012
65d0e82
Merge pull request #198 from typingduck/master
Nov 16, 2012
680f670
Merge git://github.com/mitsuhiko/werkzeug into 0.8-maintenance
jace Dec 13, 2012
191afe2
Merge branch 'fix-issue-185' of https://github.com/jasonLaster/werkze…
jace Dec 13, 2012
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
Werkzeug Changelog
==================

Version 0.9
-----------

Release date to be decided, codename to be chosen.

- Added support for :meth:`~werkzeug.wsgi.LimitedStream.tell`
on the limited stream.
- :class:`~werkzeug.datastructures.ETags` now is nonzero if it
contains at least one etag of any kind, including weak ones.
- Added a workaround for a bug in the stdlib for SSL servers.
- Improved SSL interface of the devserver so that it can generate
certificates easily and load them from files.
- Refactored test client to invoke the open method on the class
for redirects. This makes subclassing more powerful.
- :func:`werkzeug.wsgi.make_chunk_iter` and
:func:`werkzeug.wsgi.make_line_iter` now support processing of
iterators and streams.
- URL generation by the routing system now no longer quotes
``+``.
- The :func:`werkzeug.security.generate_password_hash` and
check functions now support any of the hashlib algorithms.

Version 0.8.4
-------------

Expand Down
5 changes: 2 additions & 3 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@ even in your package manager. If you use Ubuntu, try::
$ sudo apt-get install python-virtualenv

If you are on Windows and don't have the `easy_install` command, you must
install it first. Check the :ref:`windows-easy-install` section for more
information about how to do that. Once you have it installed, run the
same commands as above, but without the `sudo` prefix.
install it first. Once you have it installed, run the same commands as
above, but without the `sudo` prefix.

Once you have virtualenv installed, just fire up a shell and create
your own environment. I usually create a project folder and an `env`
Expand Down
6 changes: 3 additions & 3 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ True
>>> 'utf-8' in request.accept_charsets
True

Normalization is available, so you can savely use alternative forms
Normalization is available, so you can safely use alternative forms
to perform containment checking:

>>> 'UTF8' in request.accept_charsets
Expand Down Expand Up @@ -224,15 +224,15 @@ So imagine your standard WSGI "Hello World" application::
start_response('200 OK', [('Content-Type', 'text/plain')])
return ['Hello World!']

With request objects it would look like this::
With response objects it would look like this::

from werkzeug.wrappers import Response

def application(environ, start_response):
response = Response('Hello World!')
return response(environ, start_response)

Also unlike request objects response objects are designed to be modified.
Also, unlike request objects, response objects are designed to be modified.
So here is what you can do with them:

>>> from werkzeug.wrappers import Response
Expand Down
55 changes: 47 additions & 8 deletions docs/serving.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ additional files (like configuration files) you want to observe.

.. autofunction:: run_simple

.. autofunction:: make_ssl_devcert

.. admonition:: Information

The development server is not intended to be used on production systems.
Expand Down Expand Up @@ -118,24 +120,61 @@ is provided it will be used. That means a server can either run in HTTP
or HTTPS mode, but not both. This feature requires the Python OpenSSL
library.

The easiest way to enable SSL is to start the server in adhoc-mode. In
that case Werkzeug will generate an SSL certificate for you::
Quickstart
``````````

The easiest way to do SSL based development with Werkzeug is by using it
to generate an SSL certificate and private key and storing that somewhere
and to then put it there. For the certificate you need to provide the
name of your server on generation or a `CN`.

1. Generate an SSL key and store it somewhere:

>>> from werkzeug.serving import make_ssl_devcert
>>> make_ssl_devcert('/path/to/the/key', host='localhost')
('/path/to/the/key.crt', '/path/to/the/key.key')

2. Now this tuple can be passed as ``ssl_context`` to the
:func:`run_simple` method:

run_simple('localhost', 4000, application,
ssl_context='adhoc')
ssl_context=('/path/to/the/key.crt',
'/path/to/the/key.key'))

The downside of this of course is that you will have to acknowledge the
certificate each time the server is reloaded. You can generate a
certificate and key in advance and provide the SSL context when the server
is started::
You will have to acknowledge the certificate in your browser once then.

Loading Contexts by Hand
````````````````````````

Instead of using a tuple as ``ssl_context`` you can also create the
context programmatically. This way you have better control over it::

from OpenSSL import SSL
ctx = SSL.Context(SSL.SSLv23_METHOD)
ctx.use_privatekey_file('ssl.key')
ctx.use_certificate_file('ssl.cert')
run_simple('localhost', 4000, application, ssl_context=ctx)

A key and certificate can be created in advance using the openssl tool::
Generating Certificates
```````````````````````

A key and certificate can be created in advance using the openssl tool
instead of the :func:`make_ssl_devcert`. This requires that you have
the `openssl` command installed on your system::

$ openssl genrsa 1024 > ssl.key
$ openssl req -new -x509 -nodes -sha1 -days 365 -key ssl.key > ssl.cert

Adhoc Certificates
``````````````````

The easiest way to enable SSL is to start the server in adhoc-mode. In
that case Werkzeug will generate an SSL certificate for you::

run_simple('localhost', 4000, application,
ssl_context='adhoc')

The downside of this of course is that you will have to acknowledge the
certificate each time the server is reloaded. Adhoc certificates are
discouraged because modern browsers do a bad job at supporting them for
security reasons.
4 changes: 2 additions & 2 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ Step 2: The Base Structure

Now let's get right into and create a module for our application. Let's
create a file called `shortly.py` in the `shortly` folder. At first we
will need a bunch of imports. I will pull in here all the imports, even
if they are not used right away to keep it from being confusing::
will need a bunch of imports. I will pull in all the imports here, even
if they are not used right away, to keep it from being confusing::

import os
import redis
Expand Down
2 changes: 0 additions & 2 deletions docs/wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ are available by mixing in various mixin classes or using :class:`Request` and

.. automethod:: _get_file_stream

.. automethod:: _form_parsing_failed


.. autoclass:: BaseResponse
:members:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

setup(
name='Werkzeug',
version='0.8.4-dev',
version='0.9-dev',
url='http://werkzeug.pocoo.org/',
license='BSD',
author='Armin Ronacher',
Expand Down
2 changes: 1 addition & 1 deletion werkzeug/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


# the version. Usually set automatically by a script.
__version__ = '0.8.4-dev'
__version__ = '0.9-dev'


# This import magic raises concerns quite often which is why the implementation
Expand Down
12 changes: 9 additions & 3 deletions werkzeug/contrib/atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,11 @@ class FeedEntry(object):
not present the URL is used, but one of both is required.
:param updated: the time the entry was modified the last time. Must
be a :class:`datetime.datetime` object. Required.
:param author: the author of the feed. Must be either a string (the
:param author: the author of the entry. Must be either a string (the
name) or a dict with name (required) and uri or
email (both optional). Can be a list of (may be
mixed, too) strings and dicts, too, if there are
multiple authors. Required if not every entry has an
multiple authors. Required if the feed does not have an
author element.
:param published: the time the entry was initially published. Must
be a :class:`datetime.datetime` object.
Expand All @@ -254,6 +254,8 @@ class FeedEntry(object):
:param links: additional links. Must be a list of dictionaries with
href (required) and rel, type, hreflang, title, length
(all optional)
:param categories: categories for the entry. Must be a list of dictionaries
with term (required), scheme and label (all optional)
:param xml_base: The xml base (url) for this feed item. If not provided
it will default to the item url.

Expand All @@ -273,10 +275,11 @@ def __init__(self, title=None, content=None, feed_url=None, **kwargs):
self.updated = kwargs.get('updated')
self.summary = kwargs.get('summary')
self.summary_type = kwargs.get('summary_type', 'html')
self.author = kwargs.get('author')
self.author = kwargs.get('author', ())
self.published = kwargs.get('published')
self.rights = kwargs.get('rights')
self.links = kwargs.get('links', [])
self.categories = kwargs.get('categories', [])
self.xml_base = kwargs.get('xml_base', feed_url)

if not hasattr(self.author, '__iter__') \
Expand Down Expand Up @@ -324,6 +327,9 @@ def generate(self):
for link in self.links:
yield u' <link %s/>\n' % ''.join('%s="%s" ' % \
(k, escape(link[k], True)) for k in link)
for category in self.categories:
yield u' <category %s/>\n' % ''.join('%s="%s" ' % \
(k, escape(category[k], True)) for k in category)
if self.summary:
yield u' ' + _make_text_block('summary', self.summary,
self.summary_type)
Expand Down
17 changes: 1 addition & 16 deletions werkzeug/contrib/securecookie.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def application(environ, start_response):
:copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import sys
import cPickle as pickle
from hmac import new as hmac
from time import time
Expand All @@ -98,21 +97,7 @@ def application(environ, start_response):
from werkzeug.security import safe_str_cmp


# rather ugly way to import the correct hash method. Because
# hmac either accepts modules with a new method (sha, md5 etc.)
# or a hashlib factory function we have to figure out what to
# pass to it. If we have 2.5 or higher (so not 2.4 with a
# custom hashlib) we import from hashlib and fail if it does
# not exist (have seen that in old OS X versions).
# in all other cases the now deprecated sha module is used.
_default_hash = None
if sys.version_info >= (2, 5):
try:
from hashlib import sha1 as _default_hash
except ImportError:
pass
if _default_hash is None:
import sha as _default_hash
from hashlib import sha1 as _default_hash


class UnquoteError(Exception):
Expand Down
5 changes: 1 addition & 4 deletions werkzeug/contrib/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ def application(environ, start_response):
from os import path
from time import time
from random import random
try:
from hashlib import sha1
except ImportError:
from sha import new as sha1
from hashlib import sha1
from cPickle import dump, load, HIGHEST_PROTOCOL

from werkzeug.datastructures import CallbackDict
Expand Down
2 changes: 1 addition & 1 deletion werkzeug/datastructures.py
Original file line number Diff line number Diff line change
Expand Up @@ -2079,7 +2079,7 @@ def __call__(self, etag=None, data=None, include_weak=False):
return etag in self._strong

def __nonzero__(self):
return bool(self.star_tag or self._strong)
return bool(self.star_tag or self._strong or self._weak)

def __str__(self):
return self.to_header()
Expand Down
2 changes: 2 additions & 0 deletions werkzeug/debug/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def displayhook(obj):
# stream._write bypasses escaping as debug_repr is
# already generating HTML for us.
if obj is not None:
_local._current_ipy.locals['_'] = obj
stream._write(debug_repr(obj))
displayhook = staticmethod(displayhook)

Expand Down Expand Up @@ -201,6 +202,7 @@ def __init__(self, globals=None, locals=None):
self._ipy = _InteractiveConsole(globals, locals)

def eval(self, code):
_local._current_ipy = self._ipy
old_sys_stdout = sys.stdout
try:
return self._ipy.runsource(code)
Expand Down
14 changes: 6 additions & 8 deletions werkzeug/formparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def wrapper(self, stream, *args, **kwargs):

class FormDataParser(object):
"""This class implements parsing of form data for Werkzeug. By itself
it can parse multipart and url encoded form data. It can be subclasses
it can parse multipart and url encoded form data. It can be subclassed
and extended but for most mimetypes it is a better idea to use the
untouched stream and expose it as separate attributes on a request
object.
Expand Down Expand Up @@ -235,11 +235,10 @@ def _line_parse(line):

def parse_multipart_headers(iterable):
"""Parses multipart headers from an iterable that yields lines (including
the trailing newline symbol. The iterable has to be newline terminated:
the trailing newline symbol). The iterable has to be newline terminated.

>>> parse_multipart_headers(['Foo: Bar\r\n', 'Test: Blub\r\n',
... '\r\n', 'More data'])
Headers([('Foo', 'Bar'), ('Test', 'Blub')])
The iterable will stop at the line where the headers ended so it can be
further consumed.

:param iterable: iterable of strings that are newline terminated
"""
Expand All @@ -264,7 +263,6 @@ def parse_multipart_headers(iterable):


class MultiPartParser(object):

def __init__(self, stream_factory=None, charset='utf-8', errors='replace',
max_form_memory_size=None, cls=None, buffer_size=10 * 1024):
self.stream_factory = stream_factory
Expand Down Expand Up @@ -348,8 +346,8 @@ def validate_boundary(self, boundary):
if len(boundary) > self.buffer_size: # pragma: no cover
# this should never happen because we check for a minimum size
# of 1024 and boundaries may not be longer than 200. The only
# situation when this happen is for non debug builds where
# the assert i skipped.
# situation when this happens is for non debug builds where
# the assert is skipped.
self.fail('Boundary longer than buffer size')

def parse(self, file, boundary, content_length):
Expand Down
4 changes: 2 additions & 2 deletions werkzeug/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ def parse_options_header(value):
"""Parse a ``Content-Type`` like header into a tuple with the content
type and the options:

>>> parse_options_header('Content-Type: text/html; mimetype=text/html')
('Content-Type:', {'mimetype': 'text/html'})
>>> parse_options_header('text/html; charset=utf8')
('text/html', {'charset': 'utf8'})

This should not be used to parse ``Cache-Control`` like headers that use
a slightly different format. For these headers use the
Expand Down
Loading