Skip to content
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

feat: Make SkeletonInstance json serializable #1262

Merged

Conversation

ArneGudermann
Copy link
Contributor

This PR is a fix for #1092 and makes SkeletonInstances now json serializable.
Like:

def get_skel():
	skel = conf.main_app.country.viewSkel()
	skel.fromDB("agxoaWVyLWdpYnQtZXNyFQsSDm5pY2h0c196dXNlaGVuGLkKDA")
	return skel

foo=JsonBone(compute=Compute(fn=get_skel,interval=ComputeInterval(ComputeMethod.OnWrite),raw=True))

Now get in json render

"c_s": {
               "key": "agxoaWVyLWdpYnQtZXNyFQsSDm5pY2h0c196dXNlaGVuGLkKDA",
                "name": null,
                "creationdate": "2022-10-05T06:20:38+00:00",
                "changedate": "2024-02-05T13:20:46+00:00",
                "viurCurrentSeoKeys": {
                    "de": "4757066702913536",
                    "_viurLanguageWrapper_": true,
                    "en": "4757066702913536"
                },
                "country": "Nauru",
                "continent": "Oceania",
                "sortindex": 1664950838.329367
            }

@ArneGudermann ArneGudermann added feature New feature or request Priority: Medium This issue may be useful, and needs some attention. labels Sep 20, 2024
src/viur/core/bones/json.py Outdated Show resolved Hide resolved
Co-authored-by: Jan Max Meyer <jmm@phorward.de>
@phorward phorward added this to the ViUR-core v3.7 milestone Sep 20, 2024
Copy link
Member

@phorward phorward left a comment

Choose a reason for hiding this comment

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

Please clarify the code-snippets in the comments in the source code.

src/viur/core/utils/json.py Outdated Show resolved Hide resolved
src/viur/core/bones/json.py Outdated Show resolved Hide resolved
@phorward phorward self-requested a review September 20, 2024 11:45
@phorward phorward merged commit 88f8498 into viur-framework:develop Sep 23, 2024
3 checks passed
@phorward phorward deleted the feat/json_SkeletonInstance branch September 23, 2024 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request Priority: Medium This issue may be useful, and needs some attention.
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants