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
+2 -15
View File
@@ -30,8 +30,6 @@ to_string = unicode
#: the identity function. Useful for certain things in the environment
identity = lambda x: x
_last_iteration = object()
def markup_join(seq):
"""Concatenation that escapes if necessary and converts to unicode."""
@@ -272,7 +270,6 @@ class LoopContext(object):
def __init__(self, iterable, recurse=None):
self._iterator = iter(iterable)
self._recurse = recurse
self._after = self._safe_next()
self.index0 = -1
# try to get the length of the iterable early. This must be done
@@ -291,7 +288,7 @@ class LoopContext(object):
return args[self.index0 % len(args)]
first = property(lambda x: x.index0 == 0)
last = property(lambda x: x._after is _last_iteration)
last = property(lambda x: x.index0 + 1 == x.length)
index = property(lambda x: x.index0 + 1)
revindex = property(lambda x: x.length - x.index0)
revindex0 = property(lambda x: x.length - x.index)
@@ -302,12 +299,6 @@ class LoopContext(object):
def __iter__(self):
return LoopContextIterator(self)
def _safe_next(self):
try:
return next(self._iterator)
except StopIteration:
return _last_iteration
@internalcode
def loop(self, iterable):
if self._recurse is None:
@@ -353,11 +344,7 @@ class LoopContextIterator(object):
def next(self):
ctx = self.context
ctx.index0 += 1
if ctx._after is _last_iteration:
raise StopIteration()
next_elem = ctx._after
ctx._after = ctx._safe_next()
return next_elem, ctx
return next(ctx._iterator), ctx
class Macro(object):