<s> from functools import wraps <EOL> from text . conf import settings <EOL> def override_conf ( ** conf ) : <EOL> def decorator ( fn ) : <EOL> @ wraps ( fn ) <EOL> def override ( * args , ** kwargs ) : <EOL> org = { } <EOL> for setting , value in conf . items ( ) : <EOL> org [ setting ] = getattr ( settings , setting ) <EOL> setattr ( settings , setting , value ) <EOL> try : <EOL> return fn ( * args , ** kwargs ) <EOL> finally : <EOL> for setting , value in conf . items ( ) : <EOL> setattr ( settings , setting , org [ setting ] ) <EOL> return override <EOL> return decorator </s>
