From bbb69f9ea4c26bac99690e2286e5a3eddf8c10dd Mon Sep 17 00:00:00 2001 From: Romain Dorgueil Date: Tue, 17 Jan 2017 23:56:13 +0100 Subject: [PATCH] add ordering creation counter for python 3.5 compatibility, and 3.6 safety (as it is considered, like the docs says, an implementation detail that should not be relied upon. Still I would love it to be reliable feature, it is probably the coolest feature python added since a long time. Ok just kidding. Or not.) --- bonobo/context/processors.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bonobo/context/processors.py b/bonobo/context/processors.py index 96b4a91..0f00518 100644 --- a/bonobo/context/processors.py +++ b/bonobo/context/processors.py @@ -14,6 +14,8 @@ def get_context_processors(mixed): class ContextProcessor: + _creation_counter = 0 + @property def __name__(self): return self.func.__name__ @@ -21,6 +23,10 @@ class ContextProcessor: def __init__(self, func): self.func = func + # This hack is necessary for python3.5 + self._creation_counter = ContextProcessor._creation_counter + ContextProcessor._creation_counter += 1 + def __repr__(self): return repr(self.func).replace('