Permalink
Browse files

use base64 instead of uu. #11

  • Loading branch information...
1 parent 165922e commit f01aeed5fa98ff88b441fe3094045b38f300592d @knipknap committed Aug 23, 2012
Showing with 9 additions and 7 deletions.
  1. +9 −7 SpiffWorkflow/storage/DictionarySerializer.py
@@ -12,7 +12,7 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import marshal
-from binascii import b2a_uu, a2b_uu
+from base64 import b64encode, b64decode
from SpiffWorkflow import Workflow
from SpiffWorkflow.util.impl import get_class
from SpiffWorkflow.Task import Task
@@ -23,16 +23,18 @@
class DictionarySerializer(Serializer):
def _serialize_dict(self, thedict):
- return dict((k, b2a_uu(marshal.dumps(v))) for k, v in thedict.iteritems())
+ return dict((k, b64encode(marshal.dumps(v)))
+ for k, v in thedict.iteritems())
def _deserialize_dict(self, s_state):
- return dict((k, marshal.loads(a2b_uu(v))) for k, v in s_state.iteritems())
+ return dict((k, marshal.loads(b64decode(v)))
+ for k, v in s_state.iteritems())
def _serialize_list(self, thedict):
- return [(k, b2a_uu(marshal.dumps(v))) for k, v in thedict]
+ return [(k, b64encode(marshal.dumps(v))) for k, v in thedict]
def _deserialize_list(self, s_state):
- return [(k, a2b_uu(marshal.loads(v))) for k, v in s_state]
+ return [(k, b64decode(marshal.loads(v))) for k, v in s_state]
def _serialize_attrib(self, attrib):
return attrib.name
@@ -237,15 +239,15 @@ def _deserialize_gate(self, wf_spec, s_state):
def _serialize_join(self, spec):
s_state = self._serialize_task_spec(spec)
s_state['split_task'] = spec.split_task
- s_state['threshold'] = b2a_uu(marshal.dumps(spec.threshold))
+ s_state['threshold'] = b64encode(marshal.dumps(spec.threshold))
s_state['cancel_remaining'] = spec.cancel_remaining
return s_state
def _deserialize_join(self, wf_spec, s_state):
spec = Join(wf_spec,
s_state['name'],
split_task = s_state['split_task'],
- threshold = marshal.loads(a2b_uu(s_state['threshold'])),
+ threshold = marshal.loads(b64decode(s_state['threshold'])),
cancel = s_state['cancel_remaining'])
self._deserialize_task_spec(wf_spec, s_state, spec = spec)
return spec

0 comments on commit f01aeed

Please sign in to comment.