-
Notifications
You must be signed in to change notification settings - Fork 13
fix: CallDeferred
with SkeletonInstance
#1518
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
base: develop
Are you sure you want to change the base?
fix: CallDeferred
with SkeletonInstance
#1518
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also stumbled across this about a year ago and decided at the time that this problem could not be solved.
It's precisely about these edge cases: What if, for example, a subskel or even ActionSkel with a different bone order is put in here? Then there is no child and a skeletonByKind also fails.
I would therefore like to open this topic for discussion.
data = obj.dbEntity | ||
if data is None: | ||
data ={} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data = obj.dbEntity | |
if data is None: | |
data ={} | |
data = obj.dbEntity or {} |
if data is None: | ||
data ={} | ||
return { | ||
".__entity__": ViURJsonEncoder.preprocess(dict(data)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
db.Entity
inherits from dict
. I think this is obsolete, but please test.
".__entity__": ViURJsonEncoder.preprocess(dict(data)), | |
".__entity__": ViURJsonEncoder.preprocess(data), |
@@ -80,6 +87,15 @@ def _decode_object_hook(obj: t.Any): | |||
entity = db.Entity(db.Key.from_legacy_urlsafe(obj[".__key__"]) if obj[".__key__"] else None) | |||
entity.update(obj[".__entity__"]) | |||
return entity | |||
elif len(obj) == 3 and all(k in obj for k in (".__entity__", ".__key__", ".__skel__")): | |||
from viur.core.skeleton.utils import skeletonByKind | |||
skel = skeletonByKind(obj[".__skel__"])() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if a subskel of a given kind was provided? This won't work.
Fix for #1390