Update Flask

This commit is contained in:
Ruud
2012-10-29 10:54:38 +01:00
parent c0900cfe94
commit b0f6f9b2ea
111 changed files with 817 additions and 477 deletions
Executable → Regular
+7 -26
View File
@@ -11,10 +11,6 @@
import re
import sys
import errno
try:
from urllib.parse import quote_from_bytes as url_quote
except ImportError:
from urllib import quote as url_quote
try:
from thread import allocate_lock
except ImportError:
@@ -67,7 +63,7 @@ except TypeError, _error:
del _test_gen_bug, _error
# for python 2.x we create ourselves a next() function that does the
# for python 2.x we create outselves a next() function that does the
# basics without exception catching.
try:
next = next
@@ -132,7 +128,7 @@ def contextfunction(f):
def evalcontextfunction(f):
"""This decorator can be used to mark a function or method as an eval
"""This decoraotr can be used to mark a function or method as an eval
context callable. This is similar to the :func:`contextfunction`
but instead of passing the context, an evaluation context object is
passed. For more information about the eval context, see
@@ -195,7 +191,7 @@ def clear_caches():
def import_string(import_name, silent=False):
"""Imports an object based on a string. This is useful if you want to
"""Imports an object based on a string. This use useful if you want to
use import paths as endpoints or something similar. An import path can
be specified either in dotted notation (``xml.sax.saxutils.escape``)
or with a colon as object delimiter (``xml.sax.saxutils:escape``).
@@ -353,21 +349,6 @@ def generate_lorem_ipsum(n=5, html=True, min=20, max=100):
return Markup(u'\n'.join(u'<p>%s</p>' % escape(x) for x in result))
def unicode_urlencode(obj, charset='utf-8'):
"""URL escapes a single bytestring or unicode string with the
given charset if applicable to URL safe quoting under all rules
that need to be considered under all supported Python versions.
If non strings are provided they are converted to their unicode
representation first.
"""
if not isinstance(obj, basestring):
obj = unicode(obj)
if isinstance(obj, unicode):
obj = obj.encode(charset)
return unicode(url_quote(obj))
class LRUCache(object):
"""A simple LRU Cache implementation."""
@@ -412,7 +393,7 @@ class LRUCache(object):
return (self.capacity,)
def copy(self):
"""Return a shallow copy of the instance."""
"""Return an shallow copy of the instance."""
rv = self.__class__(self.capacity)
rv._mapping.update(self._mapping)
rv._queue = deque(self._queue)
@@ -462,7 +443,7 @@ class LRUCache(object):
"""Get an item from the cache. Moves the item up so that it has the
highest priority then.
Raise a `KeyError` if it does not exist.
Raise an `KeyError` if it does not exist.
"""
rv = self._mapping[key]
if self._queue[-1] != key:
@@ -497,7 +478,7 @@ class LRUCache(object):
def __delitem__(self, key):
"""Remove an item from the cache dict.
Raise a `KeyError` if it does not exist.
Raise an `KeyError` if it does not exist.
"""
self._wlock.acquire()
try:
@@ -598,7 +579,7 @@ class Joiner(object):
# try markupsafe first, if that fails go with Jinja2's bundled version
# of markupsafe. Markupsafe was previously Jinja2's implementation of
# the Markup object but was moved into a separate package in a patchlevel
# the Markup object but was moved into a separate package in a patchleve
# release
try:
from markupsafe import Markup, escape, soft_unicode