From a28a565a612cb174d4febba0516d7460cdcc7e47 2010-08-19 20:40:11 From: Brian Granger Date: 2010-08-19 20:40:11 Subject: [PATCH] Adding payload module. --- diff --git a/IPython/core/payload.py b/IPython/core/payload.py new file mode 100644 index 0000000..4c66f45 --- /dev/null +++ b/IPython/core/payload.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +"""Payload system for IPython. + +Authors: + +* Fernando Perez +* Brian Granger +""" + +#----------------------------------------------------------------------------- +# Copyright (C) 2008-2010 The IPython Development Team +# +# Distributed under the terms of the BSD License. The full license is in +# the file COPYING, distributed as part of this software. +#----------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- + +from IPython.config.configurable import Configurable +from IPython.utils.traitlets import Dict + +#----------------------------------------------------------------------------- +# Main payload class +#----------------------------------------------------------------------------- + +class PayloadManager(Configurable): + + _payload = Dict({}) + + def write_payload(self, key, value): + self.payload[key] = value + + def reset_payload(self): + self.payload = {} + + def read_payload(self): + return self._payload