refactoring contexts, moved json writer to a class as it make more sense.

This commit is contained in:
Romain Dorgueil
2016-12-27 09:06:44 +01:00
parent f37f178630
commit 512e2ab46d
8 changed files with 173 additions and 140 deletions

View File

@ -25,6 +25,10 @@ get_initializer, set_initializer = _create_lifecycle_functions('initializer', 'i
get_finalizer, set_finalizer = _create_lifecycle_functions('finalizer', 'finalize')
def with_context(func):
func._with_context = True
return func
class Contextual:
_with_context = True
def with_context(cls_or_func):
cls_or_func._with_context = True
return cls_or_func