CCCP - Semi Server Side Rendered ☭
CCCP uses dominate for generation of HTML in Python but extends it with JavaScript snippets
Includes:
- Custom elements that can be rendered:
- Function declarations for simple DOM manipulation
- Indludes of external scripts (like jquery etc.)
- Render function that can take a single or lists of dominate HTML elements
HTML tag manipulation using external sourcecode from GET's
CCCP currently includes the following functions:
(They all work by fetching html from a remote endpoint and manipulating a HTML tag with a given id)
- ReplaceHtml(url, id): Lets you replace the contents of an HTML tag
- AppendHtml(url, id): Lets you append to the end of a HTML tag
- PrependHtml(url, id): Lets you prepend to the beginning of a HTML tag
Usage
Install from PYPI (also installs dominate):
$ pip install cccp
Import modules:
from dominate import tags as t
import cccp
Include needed definitions in HTML Head:
t.head(
[
cccp.REQUIRED,
cccp.BOOTSTRAP,
cccp.CreateReplaceHtmlFunc()
]
)
],
t.body(
[
div(id="pageContent")
]
)
Use functions inside HTML to manipulate select DOM elements:
t.button(
"go to blog",
onClick=cccp.replaceHtml(
"http://127.0.0.1:9999/page/1", "pageContent"
),
)
☝️This will replace the contents of the div "pageContent" with the HTML it GET's from "http://127.0.0.1:9999/page/1"
see examples/flask_example.py for a full demo!
RoadMap
- Simple functions for replacing/appending/prepending of DOM elements
- Elements for popular js dependencies:
- axios used for HTTP requests (performs GET requests)
- jquery used for HTTP requests (does the DOM manipulation)
- Error handling in bundled javascript functions
- Simple html forms using json-schema for form validation etc
- Implement tests
- chartjs:
- Element for including library
- Functions for creating different kinds of interactive charts
- More DOM manipulation javascript functions:
- Function for creating a Comet call and replacing/prepending/appending incomming html to the DOM
- Functions for deleting DOM elements
- Functions for pulling regularily (timer interupt GET's)
0.0.1
- implement simple javascript functions for DOM manipulations
- create example using flask
0.0.2
- fix bugs
- introduce more js snippets
0.0.3
- fix css snippet
0.0.4
- add xkcd line chart snippet
0.0.10
- drop xkcd chart and use chartjs
0.0.11
- line chart take options
Metadata
Release files for cccp 0.0.11
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 |
|---|---|---|---|---|
| cccp-0.0.11.tar.gz | 4.6 kB | Without provenance | Details for cccp-0.0.11.tar.gz |
Release files / cccp-0.0.11.tar.gz
| Download URL | cccp-0.0.11.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12cfbecaddaa4ebb3d12cd39877db202581b864e4e8fdc0d898267536839b242
|
|
BLAKE2b-256 checksum How to use checksums |
03b2e8f116f2ed5fca6408014187d71f73c2e7d9f524d3c0cfed4d94d3c9cb3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.3
|
Security for cccp 0.0.11
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.