8000 Fix compute_hash by mdrichardson · Pull Request #450 · microsoft/botbuilder-python · GitHub
[go: up one dir, main page]

Skip to content

Fix compute_hash #450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libraries/botbuilder-core/botbuilder/core/bot_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from abc import abstractmethod
from copy import deepcopy
from typing import Callable, Dict, Union
from jsonpickle.pickler import Pickler
from botbuilder.core.state_property_accessor import StatePropertyAccessor
from .turn_context import TurnContext
from .storage import Storage
Expand All @@ -24,8 +25,7 @@ def is_changed(self) -> bool:
return self.hash != self.compute_hash(self.state)

def compute_hash(self, obj: object) -> str:
# TODO: Should this be compatible with C# JsonConvert.SerializeObject ?
return str(obj)
return str(Pickler().flatten(obj))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch! This is so important that I'm surprised that didn't blow up earlier



class BotState(PropertyManager):
Expand Down
0