KBPC
Table of contents
Database
Models
User Model
Docs coming soon
User DAO
Docs coming soon
Flask Alchemy Model Serializer
Transformation was originally a series of routines written to convert FlaskAlchemy models into jsonifiable dict structures. This proved to be a solution lacking elegance and evolved and eventually found its way into half a dozen projects over time and eventually, then started to splinter into slightly different variations.
Basic Usage
from flask import jsonify
from application.models import SomeFlaskAlchemyModel
from kbpc.db.flaskalchemy import serializer
# Assume the model has name and age as the model fields
model = SomeFlaskAlchemyModel('John Doe', 25)
transformed_model = serializer.serialize(model)
# This typically fails if you attempt it with the model.
json = jsonify(data=model)
# This however is serializable immediately
json = jsonify(data=transformed_model)
Often, fields like passwords or other sensitive data should be hidden from responses or outputs. Usually this would be managed at the model class, and writing a to_dict() function or something similar, and simply not declaring the protected properties of that instance.
Protected Properties
from flask import jsonify
from application.models import SomeFlaskAlchemyModel
from kbpc.db.flaskalchemy import serializer
# Assume the model has name and age as the model fields
model = SomeFlaskAlchemyModel('John Doe', 25)
tablename = 'tablename_of_model'
exclusions = {tablename: ['age']}
transformed_model = serializer.serialize(model, exclusions)
# This however is serializable immediately
json = jsonify(data=transformed_model)
Metadata
Release files for Flask-Electron 0.4.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| Flask-Electron-0.4.9.tar.gz | 13.3 kB | Without provenance | Details for Flask-Electron-0.4.9.tar.gz |
Release files / Flask-Electron-0.4.9.tar.gz
| Download URL | Flask-Electron-0.4.9.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
69e2c473df63e7e2d459e666504fc6122a1401685ed11ec1608e11ac048a32f1
|
|
BLAKE2b-256 checksum How to use checksums |
9712ba0bbae752f0d8f7ec0dec6ab53d7ae24824bb014b64255d62d008024e50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.4
|
Security for Flask-Electron 0.4.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.