[session] move context manager logic in the security context manager
The `init_security` and `reset_security` method have no other user that the context manager itself. Having dedicated public function is not useful.
import ConfigParser
try:
undo_actions = config.cfgfile_parser.get('MAIN', 'undo-support', False)
except ConfigParser.NoOptionError:
pass # this conf. file was probably already migrated
else:
config.global_set_option('undo-enabled', bool(undo_actions))