Skip to content

Commit 87407e7

Browse files
committed
fix double adding segments for camel case conversion, and make decorator not convert strings if they are the direct return from a method
1 parent 8d276ba commit 87407e7

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

Python_Engine/Python/src/python_toolkit/bhom/bhom_object.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def convert_camel_to_pascal(s: str):
3737
continue
3838
elif sec.startswith("_"):
3939
parts.append(sec)
40+
continue
4041

4142
parts.append(sec.capitalize())
4243

Python_Engine/Python/src/python_toolkit/bhom/decorators/_bhom_callable_decorator.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ def wrapper(*args, **kwargs) -> Union[str, Any]:
6161
rtn = function(*args, **kwargs)
6262

6363
if do_wrap:
64+
#don't bother serialising if the method already returns a string.
65+
if isinstance(rtn, str):
66+
return rtn
67+
6468
json_rtn = json.dumps(rtn, cls=encoder_cls)
6569

6670
return json_rtn

0 commit comments

Comments
 (0)