Skip to content
This repository was archived by the owner on Apr 12, 2018. It is now read-only.

Commit f13e676

Browse files
committed
Merge branch 'release/0.1.34'
2 parents 3b4cb98 + a6d6cff commit f13e676

File tree

6 files changed

+43
-63
lines changed

6 files changed

+43
-63
lines changed

README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. image:: https://travis-ci.org/botify-labs/python-simple-workflow.png?branch=develop :target: https://travis-ci.org/botify-labs/python-simple-workflow
2+
13
======================
24
Python Simple Workflow
35
======================
@@ -27,4 +29,4 @@ Installation
2729
Usage and all the rest
2830
======================
2931

30-
Please, refer to `Documentation <http://python-simple-workflow.readthedocs.org>`_
32+
Please, refer to `Documentation <http://python-simple-workflow.readthedocs.org>`_

swf/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
version = (0, 1, 33)
4+
version = (0, 1, 34)
55

66
__title__ = "python-simple-workflow"
77
__author__ = "Oleiade"

swf/actors/decider.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#! -*- coding: utf-8 -*-
22

3+
import boto.exception
4+
35
from swf.models.history import History
46
from swf.actors.core import Actor
5-
from swf.exceptions import PollTimeout
7+
from swf.exceptions import PollTimeout, ResponseError, DoesNotExistError
68

79

810
class Decider(Actor):
@@ -41,7 +43,7 @@ def complete(self, task_token,
4143
decisions,
4244
execution_context,
4345
)
44-
except SWFResponseError as e:
46+
except boto.exception.SWFResponseError as e:
4547
if e.error_code == 'UnknownResourceFault':
4648
raise DoesNotExistError(
4749
"Unable to complete decision task with token: {}.\n".format(task_token),
@@ -50,7 +52,6 @@ def complete(self, task_token,
5052

5153
raise ResponseError(e.body['message'])
5254

53-
5455
def poll(self, task_list=None,
5556
identity=None,
5657
**kwargs):
@@ -94,7 +95,7 @@ def poll(self, task_list=None,
9495
next_page_token=next_page,
9596
**kwargs
9697
)
97-
except SWFResponseError as e:
98+
except boto.exception.SWFResponseError as e:
9899
if e.error_code == 'UnknownResourceFault':
99100
raise DoesNotExistError(
100101
"Unable to poll decision task.\n",

swf/models/decision/base.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from functools import wraps
99

10-
from swf.utils import decapitalize
10+
from swf.utils import decapitalize, underscore_to_camel
1111

1212

1313
def decision_action(fn):
@@ -46,8 +46,9 @@ def __init__(self, action=None, *args, **kwargs):
4646
action_method(*args, **kwargs)
4747

4848
def _fill_from_action(self, action):
49-
self.type = action.capitalize() + self._base_type
50-
self.attributes_key = decapitalize(self.type + self._attributes_key_suffix)
49+
self.type = underscore_to_camel(action) + self._base_type
50+
self.attributes_key = decapitalize(self.type +
51+
self._attributes_key_suffix)
5152

5253
self['decisionType'] = self.type
5354
self[self.attributes_key] = {}

swf/utils.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from datetime import datetime, timedelta
99
from time import mktime
10+
from itertools import chain, izip, islice
1011

1112
from functools import wraps
1213

@@ -181,3 +182,32 @@ def camel_to_underscore(string):
181182
res.extend([char.lower()])
182183

183184
return ''.join(res)
185+
186+
187+
def underscore_to_camel(string):
188+
"""
189+
190+
>>> underscore_to_camel('')
191+
''
192+
>>> underscore_to_camel('a')
193+
'A'
194+
>>> underscore_to_camel('A')
195+
'A'
196+
>>> underscore_to_camel('ab')
197+
'Ab'
198+
>>> underscore_to_camel('a_b_c')
199+
'ABC'
200+
>>> underscore_to_camel('ab_cd_ef')
201+
'AbCdEf'
202+
>>> underscore_to_camel('request_cancel_workflow')
203+
'RequestCancelWorkflow'
204+
205+
"""
206+
if string == '':
207+
return ''
208+
209+
return ''.join(chain([string[0].upper()],
210+
((c.upper() if p == '_' else c) if
211+
c != '_' else '' for p, c in
212+
izip(islice(string, 0, None),
213+
islice(string, 1, None)))))

tests/actors/test_decider.py

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)