pax_global_header 0000666 0000000 0000000 00000000064 14424226704 0014517 g ustar 00root root 0000000 0000000 52 comment=9f9a11a5fc50dc530016d9e33631775aadc5ff46
django-sekizai-4.1.0/ 0000775 0000000 0000000 00000000000 14424226704 0014420 5 ustar 00root root 0000000 0000000 django-sekizai-4.1.0/.coveragerc 0000664 0000000 0000000 00000000447 14424226704 0016546 0 ustar 00root root 0000000 0000000 [run]
branch = True
source = sekizai
omit =
migrations/*
tests/*
[report]
exclude_lines =
pragma: no cover
def __repr__
if self.debug:
if settings.DEBUG
raise AssertionError
raise NotImplementedError
if 0:
if __name__ == .__main__.:
ignore_errors = True
django-sekizai-4.1.0/.editorconfig 0000664 0000000 0000000 00000000652 14424226704 0017100 0 ustar 00root root 0000000 0000000 # editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 80
[*.py]
max_line_length = 120
quote_type = single
[*.{scss,js,html}]
max_line_length = 120
indent_style = space
quote_type = double
[*.js]
max_line_length = 120
quote_type = single
[*.rst]
max_line_length = 80
[*.yml]
indent_size = 2
django-sekizai-4.1.0/.github/ 0000775 0000000 0000000 00000000000 14424226704 0015760 5 ustar 00root root 0000000 0000000 django-sekizai-4.1.0/.github/workflows/ 0000775 0000000 0000000 00000000000 14424226704 0020015 5 ustar 00root root 0000000 0000000 django-sekizai-4.1.0/.github/workflows/codeql-analysis.yml 0000664 0000000 0000000 00000002112 14424226704 0023624 0 ustar 00root root 0000000 0000000 name: "CodeQL"
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '41 7 * * 5'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
# âī¸ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
django-sekizai-4.1.0/.github/workflows/docs.yml 0000664 0000000 0000000 00000000717 14424226704 0021475 0 ustar 00root root 0000000 0000000 name: Docs
on: [push, pull_request]
jobs:
docs:
runs-on: ubuntu-latest
name: docs
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- run: python -m pip install -r docs/requirements.txt
- name: Build docs
run: |
cd docs
sphinx-build -b dirhtml -n -d build/doctrees . build/dirhtml
django-sekizai-4.1.0/.github/workflows/lint.yml 0000664 0000000 0000000 00000001571 14424226704 0021512 0 ustar 00root root 0000000 0000000 name: Lint
on: [push, pull_request]
jobs:
flake8:
name: flake8
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install flake8
run: pip install --upgrade flake8
- name: Run flake8
uses: liskin/gh-problem-matcher-wrap@v1
with:
linters: flake8
run: flake8
isort:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- run: python -m pip install isort
- name: isort
uses: liskin/gh-problem-matcher-wrap@v1
with:
linters: isort
run: isort --check --diff sekizai
django-sekizai-4.1.0/.github/workflows/publish-to-live-pypi.yml 0000664 0000000 0000000 00000001466 14424226704 0024551 0 ustar 00root root 0000000 0000000 name: Publish đ đĻ to pypi
on:
release:
types:
- published
jobs:
build-n-publish:
name: Build and publish đ đĻ to pypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish đĻ to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
django-sekizai-4.1.0/.github/workflows/publish-to-test-pypi.yml 0000664 0000000 0000000 00000001551 14424226704 0024564 0 ustar 00root root 0000000 0000000 name: Publish đ đĻ to TestPyPI
on:
push:
branches:
- master
jobs:
build-n-publish:
name: Build and publish đ đĻ to TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish đĻ to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
django-sekizai-4.1.0/.github/workflows/test.yml 0000664 0000000 0000000 00000003356 14424226704 0021526 0 ustar 00root root 0000000 0000000 name: CodeCov tests
on: [push, pull_request]
jobs:
unit-tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10']
django-version: ['3.2', '4.0', '4.1']
os: [
ubuntu-20.04,
]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install django==${{ matrix.django-version }} coverage
python setup.py install
- name: Run coverage
run: coverage run setup.py test
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v1
unit-tests-future-versions:
# Runs for all Django/Python versions which are not yet supported
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11']
django-version: [
'https://github.com/django/django/archive/main.tar.gz'
]
os: [
ubuntu-20.04,
]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ${{ matrix.django-version }} coverage
python setup.py install
- name: Run coverage
run: coverage run setup.py test
continue-on-error: true
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
django-sekizai-4.1.0/.gitignore 0000664 0000000 0000000 00000000265 14424226704 0016413 0 ustar 00root root 0000000 0000000 *.py[cod]
*$py.class
*.egg-info
*.log
*.pot
.DS_Store
.coverage
.eggs/
.idea/
.project/
.pydevproject/
.vscode/
.settings/
.tox/
__pycache__/
build/
dist/
env/
.venv/
local.sqlite
django-sekizai-4.1.0/.pre-commit-config.yaml 0000664 0000000 0000000 00000001657 14424226704 0020712 0 ustar 00root root 0000000 0000000 ci:
autofix_commit_msg: |
ci: auto fixes from pre-commit hooks
for more information, see https://pre-commit.ci
autofix_prs: false
autoupdate_commit_msg: 'ci: pre-commit autoupdate'
autoupdate_schedule: monthly
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.2
hooks:
- id: pyupgrade
args: ["--py38-plus"]
- repo: https://github.com/adamchainz/django-upgrade
rev: '1.13.0'
hooks:
- id: django-upgrade
args: [--target-version, "3.2"]
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
- repo: https://github.com/asottile/yesqa
rev: v1.4.0
hooks:
- id: yesqa
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-merge-conflict
- id: mixed-line-ending
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
django-sekizai-4.1.0/CHANGELOG.rst 0000664 0000000 0000000 00000002445 14424226704 0016446 0 ustar 00root root 0000000 0000000 =========
Changelog
=========
unreleased
==========
4.1.0 2023-05-02
================
* Added django 4.2 and main to the test suite
* Fix bug which let checks fail on templates using
the with_data template tag.
4.0.0 2022-07-26
================
* Django 4 support added
* Dropped python 3.7, django 2.2 and 3.1
3.0.1 2022-02-01
================
* Fix for tests in sdist tarball [#115]
3.0.0 2022-01-22
================
* Added support for Django 3.2
* Drop support for python 3.5 and 3.6
2.0.0 (2020-08-26)
==================
* Added support for Django 3.1
* Dropped support for Python 2.7 and Python 3.4
* Dropped support for Django < 2.2
* Replaced pep8 with flake8
* Adapted documentation
1.1.0 (2020-01-22)
==================
* Added support for Django 3.0
* Added support for Python 3.8
* Extended test matrix
* Added isort and adapted imports
* Adapted code base to align with other supported addons
* Adapted ``README.rst`` instructions
1.0.0 (2019-04-11)
==================
* Added support for Django 1.11, 2.0, 2.1, and 2.2
* Removed support for Django < 1.11
0.10.0 (2016-08-28)
===================
* Added support for Django 1.10
* Removed support for Python 2.6
0.9.0 (2015-12-06)
==================
* Added Changelog
* Added support for Django 1.9
* Added support for Python 3.5
django-sekizai-4.1.0/LICENSE 0000664 0000000 0000000 00000002716 14424226704 0015433 0 ustar 00root root 0000000 0000000 Copyright (c) 2010, Jonas Obrist
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Jonas Obrist nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL JONAS OBRIST BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. django-sekizai-4.1.0/MANIFEST.in 0000664 0000000 0000000 00000000232 14424226704 0016153 0 ustar 00root root 0000000 0000000 include LICENSE
include README.rst
recursive-exclude * *.py[co]
recursive-include tests *.html
recursive-include tests *.py
recursive-include tests *.txt
django-sekizai-4.1.0/README.rst 0000664 0000000 0000000 00000006270 14424226704 0016114 0 ustar 00root root 0000000 0000000 ==============
Django Sekizai
==============
|pypi| |build| |coverage|
Sekizai means "blocks" in Japanese, and that's what this app provides. A fresh
look at blocks. With django-sekizai you can define placeholders where your
blocks get rendered and at different places in your templates append to those
blocks. This is especially useful for css and javascript. Your sub-templates can
now define css and Javascript files to be included, and the css will be nicely
put at the top and the Javascript to the bottom, just like you should. Also
sekizai will ignore any duplicate content in a single block.
There are some issue/restrictions with this implementation due to how the
django template language works, but if used properly it can be very useful and
it is the media handling framework for the django CMS (since version 2.2).
.. note::
This project is endorsed by the `django CMS Association `_.
That means that it is officially accepted by the dCA as being in line with our roadmap vision and development/plugin policy.
Join us on `Slack `_.
*******************************************
Contribute to this project and win rewards
*******************************************
Because this is a an open-source project, we welcome everyone to
`get involved in the project `_ and
`receive a reward `_ for their contribution.
Become part of a fantastic community and help us make django CMS the best CMS in the world.
We'll be delighted to receive your
feedback in the form of issues and pull requests. Before submitting your
pull request, please review our `contribution guidelines
`_.
We're grateful to all contributors who have helped create and maintain this package.
Contributors are listed at the `contributors `_
section.
Documentation
=============
See ``REQUIREMENTS`` in the `setup.py `_
file for additional dependencies:
|python| |django|
Please refer to the documentation in the docs/ directory for more information or visit our
`online documentation `_.
Running Tests
-------------
You can run tests by executing::
virtualenv env
source env/bin/activate
pip install -r tests/requirements.txt
python setup.py test
.. |pypi| image:: https://badge.fury.io/py/django-sekizai.svg
:target: http://badge.fury.io/py/django-sekizai
.. |build| image:: https://travis-ci.org/divio/django-sekizai.svg?branch=master
:target: https://travis-ci.org/divio/django-sekizai
.. |coverage| image:: https://codecov.io/gh/divio/django-sekizai/branch/master/graph/badge.svg
:target: https://codecov.io/gh/divio/django-sekizai
.. |python| image:: https://img.shields.io/badge/python-3.5+-blue.svg
:target: https://pypi.org/project/django-sekizai/
.. |django| image:: https://img.shields.io/badge/django-2.2,%203.0,%203.1-blue.svg
:target: https://www.djangoproject.com/
django-sekizai-4.1.0/docs/ 0000775 0000000 0000000 00000000000 14424226704 0015350 5 ustar 00root root 0000000 0000000 django-sekizai-4.1.0/docs/Makefile 0000664 0000000 0000000 00000006106 14424226704 0017013 0 ustar 00root root 0000000 0000000 # Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
help:
@echo "Please use \`make ' where is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/django-sekizai.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/django-sekizai.qhc"
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
django-sekizai-4.1.0/docs/conf.py 0000664 0000000 0000000 00000014215 14424226704 0016652 0 ustar 00root root 0000000 0000000 #
# django-sekizai documentation build configuration file, created by
# sphinx-quickstart on Tue Jun 29 23:12:20 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.append(os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = []
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'django-sekizai'
copyright = '2010, Jonas Obrist'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.6'
# The full version, including alpha/beta/rc tags.
release = '0.6.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of documents that shouldn't be included in the build.
#unused_docs = []
# List of directories, relative to source directory, that shouldn't be searched
# for source files.
exclude_trees = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# " v documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_use_modindex = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = ''
# Output file base name for HTML help builder.
htmlhelp_basename = 'django-sekizaidoc'
# -- Options for LaTeX output --------------------------------------------------
# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'django-sekizai.tex', 'django-sekizai Documentation',
'Jonas Obrist', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_use_modindex = True
django-sekizai-4.1.0/docs/index.rst 0000664 0000000 0000000 00000031413 14424226704 0017213 0 ustar 00root root 0000000 0000000 .. django-sekizai documentation master file, created by
sphinx-quickstart on Tue Jun 29 23:12:20 2010.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
##########################################
Welcome to django-sekizai's documentation!
##########################################
.. note::
If you get an error when using django-sekizai that starts with
**Invalid block tag:**, please read :ref:`restrictions`.
*****
About
*****
Sekizai means "blocks" in Japanese, and that's what this app provides. A fresh
look at blocks. With django-sekizai you can define placeholders where your
blocks get rendered and at different places in your templates append to those
blocks. This is especially useful for css and javascript. Your sub-templates can
now define css and Javascript files to be included, and the css will be nicely
put at the top and the Javascript to the bottom, just like you should. Also
sekizai will ignore any duplicate content in a single block.
*****
Usage
*****
Configuration
=============
In order to get started with django-sekizai, you'll need to do the following
steps:
* Put 'sekizai' into your ``INSTALLED_APPS`` setting.
* Add ``sekizai.context_processors.sekizai`` to your
``TEMPLATES['OPTIONS']['context_processors']`` setting and use
``django.template.RequestContext`` when rendering your templates.
Template Tag Reference
======================
.. highlight:: html+django
.. note:: All sekizai template tags require the ``sekizai_tags`` template tag
library to be loaded.
Handling code snippets
----------------------
.. versionadded:: 0.7
The ``strip`` flag was added.
Sekizai uses ``render_block`` and ``addtoblock`` to handle unique code snippets.
Define your blocks using ``{% render_block %}`` and add data to that
block using ``{% addtoblock [strip] %}...{% endaddtoblock %}``. If the
strip flag is set, leading and trailing whitespace will be removed.
Example Template::
{% load sekizai_tags %}
{% block css %}{% endblock %}
{% render_block "css" %}
Your content comes here.
Maybe you want to throw in some css:
{% addtoblock "css" %}
{% endaddtoblock %}
Some more content here.
{% addtoblock "js" %}
{% endaddtoblock %}
And even more content.
{% block js %}{% endblock %}
{% render_block "js" %}
Above example would roughly render like this::
Your content comes here.
Maybe you want to throw in some css:
Some more content here.
And even more content.
.. note::
It's recommended to have all ``render_block`` tags in your base template, the one that gets extended by all your
other templates.
.. _restrictions:
Restrictions
------------
.. warning::
``{% render_block %}`` tags **must not** be placed inside a template tag block (a template tag which has an
end tag, such as ``{% block %}...{% endblock %}`` or ``{% if %}...{% endif %}``).
.. warning::
``{% render_block %}`` tags **must not** be in an included template!
.. warning::
If the ``{% addtoblock %}`` tag is used in an **extending** template, the tags **must** be
placed within ``{% block %}...{% endblock %}`` tags. If this block extension, where ``{% addtoblock %}``
lies, is actually overridden in a child template (i.e by a same-name block which doesn't call ``block.super``),
then this ``{% addtoblock %}`` will be ignored.
.. warning::
``{% addtoblock %}`` tags **must not** be used in a template included with ``only`` option!
Handling data
-------------
Sometimes you might not want to use code snippets but rather just add a value to
a list. For this purpose there are the
``{% with_data as %}...{% end_with_data %}`` and
``{% add_data %}`` template tags.
Example::
{% load sekizai_tags %}
{% with_data "css-data" as stylesheets %}
{% for stylesheet in stylesheets %}
{% endfor %}
{% end_with_data %}
Your content comes here.
Maybe you want to throw in some css:
{% add_data "css-data" "css/stylesheet.css" %}
Some more content here.
Above example would roughly render like this::
Your content comes here.
Maybe you want to throw in some css:
Some more content here.
And even more content.
.. warning::
The restrictions for ``{% render_block %}`` also apply to ``{% with_data %}``, see above.
The restrictions for ``{% addtoblock %}`` also apply to ``{% add_data %}``, see above.
Sekizai data is unique
----------------------
All data in sekizai is enforced to be unique within its block namespace. This
is because the main purpose of sekizai is to handle javascript and css
dependencies in templates.
A simple example using ``addtoblock`` and ``render_block`` would be::
{% load sekizai_tags %}
{% addtoblock "js" %}
{% endaddtoblock %}
{% addtoblock "js" %}
{% endaddtoblock %}
{% addtoblock "js" %}
{% endaddtoblock %}
{% addtoblock "js" %}
{% endaddtoblock %}
{% render_block "js" %}
Above template would roughly render to::
.. versionadded:: 0.5
Processing sekizai data
-----------------------
Because of the restrictions of the ``{% render_block %}`` tag, it is not possible
to use sekizai with libraries such as django-compressor directly. For that
reason, sekizai added postprocessing capabilities to ``render_block`` in
version 0.5.
Postprocessors are callable Python objects (usually functions) that get the
render context, the data in a sekizai namespace and the name of the namespace
passed as arguments and should return a string.
An example for a processor that uses the Django builtin spaceless functionality
would be:
.. code-block:: python
def spaceless_post_processor(context, data, namespace):
from django.utils.html import strip_spaces_between_tags
return strip_spaces_between_tags(data)
To use this post processor you have to tell ``render_block`` where it's
located. If above code sample lives in the Python module
``myapp.sekizai_processors`` you could use it like this::
...
{% render_block "js" postprocessor "myapp.sekizai_processors.spaceless_post_processor" %}
...
It's also possible to pre-process data in ``{% addtoblock %}`` like this::
{% addtoblock "css" preprocessor "myapp.sekizai_processors.processor" %}
*******
Helpers
*******
:mod:`sekizai.helpers`
======================
.. function:: get_namespaces(template)
Returns a list of all sekizai namespaces found in ``template``, which should
be the name of a template. This method also checks extended templates.
.. function:: validate_template(template, namespaces)
Returns ``True`` if all namespaces given are found in the template given.
Useful to check that the namespaces required by your application are
available, so you can failfast if they're not.
*******
Example
*******
.. highlight:: html+django
A full example on how to use django-sekizai and when.
Let's assume you have a website, where all templates extend base.html, which
just contains your basic HTML structure. Now you also have a small template
which gets included on some pages. This template needs to load a javascript
library and execute some specific javascript code.
Your ``base.html`` might look like this::
{% load sekizai_tags %}
Your website
{% render_block "css" %}
{% block "content" %}
{% endblock %}
{% render_block "js" %}
As you can see, we load ``sekizai_tags`` at the very beginning. We have two
sekizai namespaces: "css" and "js". The "css" namespace is rendered in the head
right after the base css files, the "js" namespace is rendered at the very
bottom of the body, right after we load jQuery.
Now to our included template. We assume there's a context variable called
``userid`` which will be used with the javascript code.
Your template (``inc.html``) might look like this::
{% load sekizai_tags %}
{% addtoblock "js" %}
{% endaddtoblock %}
{% addtoblock "js" %}
{% endaddtoblock %}
The important thing to notice here is that we split the javascript into two
``addtoblock`` blocks. Like this, the library 'mylib.js' is only included once,
and the userid specific code will be included once per userid.
Now to put it all together let's assume we render a third template with
``[1, 2, 3]`` as ``my_userids`` variable.
The third template looks like this::
{% extends "base.html" %}
{% block "content" %}
{% for userid in my_userids %}
{% include "inc.html" %}
{% endfor %}
{% endblock %}
And here's the rendered template::
Your website
*********
Changelog
*********
See `CHANGELOG.rst `_ for a full list.
django-sekizai-4.1.0/docs/requirements.txt 0000664 0000000 0000000 00000000210 14424226704 0020625 0 ustar 00root root 0000000 0000000 django<4.1
MarkupSafe
Pygments
restructuredtext_lint
sphinx
sphinxcontrib-spelling
sphinx-autobuild
sphinxcontrib-inlinesyntaxhighlight
django-sekizai-4.1.0/requirements.in 0000664 0000000 0000000 00000000113 14424226704 0017466 0 ustar 00root root 0000000 0000000 bump2version
Django>3.2
django-classy-tags>=3.0
pip-tools
pre-commit
wheel
django-sekizai-4.1.0/requirements.txt 0000664 0000000 0000000 00000002154 14424226704 0017706 0 ustar 00root root 0000000 0000000 #
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
#
# pip-compile
#
asgiref==3.5.2
# via django
build==0.8.0
# via pip-tools
bump2version==1.0.1
# via -r requirements.in
cfgv==3.3.1
# via pre-commit
click==8.1.3
# via pip-tools
distlib==0.3.5
# via virtualenv
django==4.0.8
# via
# -r requirements.in
# django-classy-tags
django-classy-tags==3.0.1
# via -r requirements.in
filelock==3.7.1
# via virtualenv
identify==2.5.2
# via pre-commit
nodeenv==1.7.0
# via pre-commit
packaging==21.3
# via build
pep517==0.12.0
# via build
pip-tools==6.8.0
# via -r requirements.in
platformdirs==2.5.2
# via virtualenv
pre-commit==2.20.0
# via -r requirements.in
pyparsing==3.0.9
# via packaging
pyyaml==6.0
# via pre-commit
sqlparse==0.4.4
# via django
toml==0.10.2
# via pre-commit
tomli==2.0.1
# via pep517
virtualenv==20.16.0
# via pre-commit
wheel==0.38.1
# via
# -r requirements.in
# pip-tools
# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
django-sekizai-4.1.0/sekizai/ 0000775 0000000 0000000 00000000000 14424226704 0016057 5 ustar 00root root 0000000 0000000 django-sekizai-4.1.0/sekizai/__init__.py 0000664 0000000 0000000 00000000026 14424226704 0020166 0 ustar 00root root 0000000 0000000 __version__ = '4.1.0'
django-sekizai-4.1.0/sekizai/context.py 0000664 0000000 0000000 00000000544 14424226704 0020120 0 ustar 00root root 0000000 0000000 from django.template import Context
from sekizai.context_processors import sekizai
class SekizaiContext(Context):
"""
An alternative context to be used instead of RequestContext in places where
no request is available.
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.update(sekizai())
django-sekizai-4.1.0/sekizai/context_processors.py 0000664 0000000 0000000 00000000506 14424226704 0022400 0 ustar 00root root 0000000 0000000 from collections import defaultdict
from sekizai.data import UniqueSequence
from sekizai.helpers import get_varname
def sekizai(request=None):
"""
Simple context processor which makes sure that the SekizaiDictionary is
available in all templates.
"""
return {get_varname(): defaultdict(UniqueSequence)}
django-sekizai-4.1.0/sekizai/context_processors.pyi 0000664 0000000 0000000 00000000300 14424226704 0022541 0 ustar 00root root 0000000 0000000 from typing import Dict, Union
from django.http import HttpRequest
from sekizai.data import UniqueSequence
def sekizai(request: Union[None, HttpRequest]) -> Dict[str, UniqueSequence]: ...
django-sekizai-4.1.0/sekizai/data.py 0000664 0000000 0000000 00000001150 14424226704 0017337 0 ustar 00root root 0000000 0000000 from collections.abc import MutableSequence
class UniqueSequence(MutableSequence):
def __init__(self):
self.data = []
def __contains__(self, item):
return item in self.data
def __iter__(self):
return iter(self.data)
def __getitem__(self, item):
return self.data[item]
def __setitem__(self, key, value):
self.data[key] = value
def __delitem__(self, key):
del self.data[key]
def __len__(self):
return len(self.data)
def insert(self, index, value):
if value not in self:
self.data.insert(index, value)
django-sekizai-4.1.0/sekizai/helpers.py 0000664 0000000 0000000 00000012425 14424226704 0020077 0 ustar 00root root 0000000 0000000 from django.conf import settings
from django.template.base import Template, Variable, VariableNode
from django.template.context import Context
from django.template.loader import get_template
from django.template.loader_tags import BlockNode, ExtendsNode
def _get_nodelist(tpl):
if isinstance(tpl, Template):
return tpl.nodelist
else:
return tpl.template.nodelist
def is_variable_extend_node(node):
if hasattr(node, 'parent_name_expr') and node.parent_name_expr:
return True
if hasattr(node, 'parent_name') and hasattr(node.parent_name, 'filters'):
if (node.parent_name.filters or
isinstance(node.parent_name.var, Variable)):
return True
return False
def get_context():
context = Context()
context.template = Template('')
return context
def _extend_blocks(extend_node, blocks):
"""
Extends the dictionary `blocks` with *new* blocks in the parent node
(recursive)
"""
# we don't support variable extensions
if is_variable_extend_node(extend_node):
return
parent = extend_node.get_parent(get_context())
# Search for new blocks
for node in _get_nodelist(parent).get_nodes_by_type(BlockNode):
if node.name not in blocks:
blocks[node.name] = node
else:
# set this node as the super node (for {{ block.super }})
block = blocks[node.name]
seen_supers = []
while (hasattr(block.super, 'nodelist') and
block.super not in seen_supers):
seen_supers.append(block.super)
block = block.super
block.super = node
# search for further ExtendsNodes
for node in _get_nodelist(parent).get_nodes_by_type(ExtendsNode):
_extend_blocks(node, blocks)
break
def _extend_nodelist(extend_node):
"""
Returns a list of namespaces found in the parent template(s) of this
ExtendsNode
"""
# we don't support variable extensions (1.3 way)
if is_variable_extend_node(extend_node):
return []
blocks = extend_node.blocks
_extend_blocks(extend_node, blocks)
found = []
for block in blocks.values():
found += _scan_namespaces(block.nodelist, block)
parent_template = extend_node.get_parent(get_context())
# if this is the topmost template, check for namespaces outside of blocks
if not _get_nodelist(parent_template).get_nodes_by_type(ExtendsNode):
found += _scan_namespaces(
_get_nodelist(parent_template),
None
)
else:
found += _scan_namespaces(
_get_nodelist(parent_template),
extend_node
)
return found
def _scan_namespaces(nodelist, current_block=None):
from sekizai.templatetags.sekizai_tags import RenderBlock, WithData
found = []
for node in nodelist:
# check if this is RenderBlock node
if isinstance(node, (RenderBlock, WithData)):
# resolve it's name against a dummy context
found.append(node.kwargs['name'].resolve({}))
found += _scan_namespaces(node.blocks['nodelist'], node)
# handle {% extends ... %} tags if check_inheritance is True
elif isinstance(node, ExtendsNode):
found += _extend_nodelist(node)
# in block nodes we have to scan for super blocks
elif isinstance(node, VariableNode) and current_block:
if node.filter_expression.token == 'block.super':
if hasattr(current_block.super, 'nodelist'):
found += _scan_namespaces(
current_block.super.nodelist,
current_block.super
)
return found
def get_namespaces(template):
compiled_template = get_template(template)
return _scan_namespaces(_get_nodelist(compiled_template))
def validate_template(template, namespaces):
"""
Validates that a template (or it's parents if check_inheritance is True)
contain all given namespaces
"""
if getattr(settings, 'SEKIZAI_IGNORE_VALIDATION', False):
return True
found = get_namespaces(template)
for namespace in namespaces:
if namespace not in found:
return False
return True
def get_varname():
return getattr(settings, 'SEKIZAI_VARNAME', 'SEKIZAI_CONTENT_HOLDER')
class Watcher:
"""
Watches a context for changes to the sekizai data, so it can be replayed
later. This is useful for caching.
NOTE: This class assumes you ONLY ADD, NEVER REMOVE data from the context!
"""
def __init__(self, context):
self.context = context
self.frozen = {
key: list(value) for key, value in self.data.items()
}
@property
def data(self):
return self.context.get(get_varname(), {})
def get_changes(self):
sfrozen = set(self.frozen)
sdata = set(self.data)
new_keys = sfrozen ^ sdata
changes = {}
for key in new_keys:
changes[key] = list(self.data[key])
shared_keys = sfrozen & sdata
for key in shared_keys:
old_set = set(self.frozen[key])
new_values = [
item for item in self.data[key] if item not in old_set
]
changes[key] = new_values
return changes
django-sekizai-4.1.0/sekizai/helpers.pyi 0000664 0000000 0000000 00000001462 14424226704 0020247 0 ustar 00root root 0000000 0000000 from typing import Dict, List, Union
from django.template.base import Node, NodeList, Template
from django.template.context import Context
def _get_nodelist(tpl: Template) -> NodeList: ...
def is_variable_extend_node(node: Node) -> bool: ...
def get_context() -> Context: ...
def _extend_blocks(extend_node: Node, blocks: Dict[str, Node]): ...
def _extend_nodelist(extend_node: Node) -> List[str]: ...
def _scan_namespaces(nodelist: NodeList, current_block: Union[None, Node]) -> List[str]: ...
def get_namespaces(template: str) -> List[str]: ...
def validate_template(template: str, namespaces: List[str]) -> bool: ...
def get_varname() -> str: ...
class Watcher:
def __init__(self, context: Context) -> None: ...
@property
def data(self) -> dict: ...
def get_changes(self) -> dict: ...
django-sekizai-4.1.0/sekizai/models.py 0000664 0000000 0000000 00000000000 14424226704 0017702 0 ustar 00root root 0000000 0000000 django-sekizai-4.1.0/sekizai/templatetags/ 0000775 0000000 0000000 00000000000 14424226704 0020551 5 ustar 00root root 0000000 0000000 django-sekizai-4.1.0/sekizai/templatetags/__init__.py 0000664 0000000 0000000 00000000000 14424226704 0022650 0 ustar 00root root 0000000 0000000 django-sekizai-4.1.0/sekizai/templatetags/sekizai_tags.py 0000664 0000000 0000000 00000010646 14424226704 0023607 0 ustar 00root root 0000000 0000000 from importlib import import_module
from django import template
from classytags.arguments import Argument, Flag
from classytags.core import Options, Tag
from classytags.parser import Parser
from sekizai.helpers import get_varname
register = template.Library()
def validate_context(context):
"""
Validates a given context.
Returns True if the context is valid.
Returns False if the context is invalid but the error should be silently
ignored.
Raises a TemplateSyntaxError if the context is invalid and we're in debug
mode.
"""
try:
template_debug = context.template.engine.debug
except AttributeError:
# Get the default engine debug value
template_debug = template.Engine.get_default().debug
if get_varname() in context:
return True
if not template_debug:
return False
raise template.TemplateSyntaxError(
"You must enable the 'sekizai.context_processors.sekizai' template "
"context processor or use 'sekizai.context.SekizaiContext' to "
"render your templates."
)
def import_processor(import_path):
if '.' not in import_path:
raise TypeError("Import paths must contain at least one '.'")
module_name, object_name = import_path.rsplit('.', 1)
module = import_module(module_name)
return getattr(module, object_name)
class SekizaiParser(Parser):
def parse_blocks(self):
super().parse_blocks()
self.blocks['nodelist'] = self.parser.parse()
class AddtoblockParser(Parser):
def parse_blocks(self):
name = self.kwargs['name'].var.token
self.blocks['nodelist'] = self.parser.parse(
('endaddtoblock', 'endaddtoblock %s' % name)
)
self.parser.delete_first_token()
class SekizaiTag(Tag):
def render(self, context):
if validate_context(context):
return super().render(context)
return ''
class RenderBlock(Tag):
name = 'render_block'
options = Options(
Argument('name'),
'postprocessor',
Argument('postprocessor', required=False, default=None, resolve=False),
parser_class=SekizaiParser,
)
def render_tag(self, context, name, postprocessor, nodelist):
if not validate_context(context):
return nodelist.render(context)
rendered_contents = nodelist.render(context)
varname = get_varname()
data = '\n'.join(context[varname][name])
if postprocessor:
func = import_processor(postprocessor)
data = func(context, data, name)
return f'{data}\n{rendered_contents}'
register.tag('render_block', RenderBlock)
class AddData(SekizaiTag):
name = 'add_data'
options = Options(
Argument('key'),
Argument('value'),
)
def render_tag(self, context, key, value):
varname = get_varname()
context[varname][key].append(value)
return ''
register.tag('add_data', AddData)
class WithData(SekizaiTag):
name = 'with_data'
options = Options(
Argument('name'),
'as',
Argument('variable', resolve=False),
blocks=[
('end_with_data', 'inner_nodelist'),
],
parser_class=SekizaiParser,
)
def render_tag(self, context, name, variable, inner_nodelist, nodelist):
rendered_contents = nodelist.render(context)
varname = get_varname()
data = context[varname][name]
context.push()
context[variable] = data
inner_contents = inner_nodelist.render(context)
context.pop()
return f'{inner_contents}\n{rendered_contents}'
register.tag('with_data', WithData)
class Addtoblock(SekizaiTag):
name = 'addtoblock'
options = Options(
Argument('name'),
Flag('strip', default=False, true_values=['strip']),
'preprocessor',
Argument('preprocessor', required=False, default=None, resolve=False),
parser_class=AddtoblockParser,
)
def render_tag(self, context, name, strip, preprocessor, nodelist):
rendered_contents = nodelist.render(context)
if strip:
rendered_contents = rendered_contents.strip()
if preprocessor:
func = import_processor(preprocessor)
rendered_contents = func(context, rendered_contents, name)
varname = get_varname()
context[varname][name].append(rendered_contents)
return ""
register.tag('addtoblock', Addtoblock)
django-sekizai-4.1.0/sekizai/templatetags/sekizai_tags.pyi 0000664 0000000 0000000 00000000263 14424226704 0023752 0 ustar 00root root 0000000 0000000 from types import ModuleType
from django.template import Context
def validate_context(context: Context) -> bool: ...
def import_processor(import_path: str) -> ModuleType: ...
django-sekizai-4.1.0/setup.cfg 0000664 0000000 0000000 00000001653 14424226704 0016246 0 ustar 00root root 0000000 0000000 [bumpversion]
current_version = 4.1.0
commit = True
tag = False
[bumpversion:file:setup.py]
search = version='{current_version}'
replace = version='{new_version}'
[bumpversion:file:sekizai/__init__.py]
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'
[bumpversion:file:CHANGELOG.rst]
search =
unreleased
==========
replace =
unreleased
==========
{new_version} {utcnow:%%Y-%%m-%%d}
================
[flake8]
max-line-length = 119
exclude =
*.egg-info,
.eggs,
.env,
.git,
.settings,
.tox,
.venv,
build,
data,
dist,
docs/conf.py,
*migrations*,
requirements,
tmp
[isort]
line_length = 119
skip = manage.py, *migrations*, .tox, .eggs, data, .env, .venv
include_trailing_comma = true
multi_line_output = 5
lines_after_imports = 2
default_section = THIRDPARTY
sections = FUTURE, STDLIB, DJANGO, THIRDPARTY, FIRSTPARTY, LOCALFOLDER
known_first_party = sekizai
known_django = django
django-sekizai-4.1.0/setup.py 0000664 0000000 0000000 00000003360 14424226704 0016134 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python
from pathlib import Path
from setuptools import find_packages, setup
REQUIREMENTS = [
'django>=3.2',
'django-classy-tags>=3.0',
]
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Framework :: Django',
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.0',
'Framework :: Django :: 4.1',
'Framework :: Django :: 4.2',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development',
'Topic :: Software Development :: Libraries',
]
this_directory = Path(__file__).parent
long_description = (this_directory / "README.rst").read_text()
setup(
name='django-sekizai',
version='4.1.0',
author='Jonas Obrist',
author_email='ojiidotch@gmail.com',
maintainer='Django CMS Association and contributors',
maintainer_email='info@django-cms.org',
url='https://github.com/django-cms/django-sekizai',
license='BSD-3-Clause',
description='Django Sekizai',
long_description=long_description,
long_description_content_type='text/x-rst',
packages=find_packages(exclude=['tests']),
python_requires='>=3.8',
include_package_data=True,
zip_safe=False,
install_requires=REQUIREMENTS,
classifiers=CLASSIFIERS,
test_suite='tests.settings.run',
)
django-sekizai-4.1.0/tests/ 0000775 0000000 0000000 00000000000 14424226704 0015562 5 ustar 00root root 0000000 0000000 django-sekizai-4.1.0/tests/__init__.py 0000664 0000000 0000000 00000000000 14424226704 0017661 0 ustar 00root root 0000000 0000000 django-sekizai-4.1.0/tests/requirements/ 0000775 0000000 0000000 00000000000 14424226704 0020305 5 ustar 00root root 0000000 0000000 django-sekizai-4.1.0/tests/requirements/base.txt 0000664 0000000 0000000 00000000051 14424226704 0021754 0 ustar 00root root 0000000 0000000 # other requirements
tox
coverage
flake8
django-sekizai-4.1.0/tests/settings.py 0000664 0000000 0000000 00000002400 14424226704 0017770 0 ustar 00root root 0000000 0000000 import os
import sys
urlpatterns = []
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'
}
}
INSTALLED_APPS = [
'sekizai',
'tests',
]
ROOT_URLCONF = 'tests.settings'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(os.path.dirname(__file__), 'templates')
],
'OPTIONS': {
'context_processors': ['sekizai.context_processors.sekizai'],
'debug': True,
},
},
]
def runtests():
from django import setup
from django.conf import settings
from django.test.utils import get_runner
settings.configure(
INSTALLED_APPS=INSTALLED_APPS,
ROOT_URLCONF=ROOT_URLCONF,
DATABASES=DATABASES,
TEST_RUNNER='django.test.runner.DiscoverRunner',
TEMPLATES=TEMPLATES,
)
setup()
# Run the test suite, including the extra validation tests.
TestRunner = get_runner(settings)
test_runner = TestRunner(verbosity=1, interactive=False, failfast=False)
failures = test_runner.run_tests(INSTALLED_APPS)
return failures
def run():
failures = runtests()
sys.exit(failures)
if __name__ == '__main__':
run()
django-sekizai-4.1.0/tests/templates/ 0000775 0000000 0000000 00000000000 14424226704 0017560 5 ustar 00root root 0000000 0000000 django-sekizai-4.1.0/tests/templates/basic.html 0000664 0000000 0000000 00000000344 14424226704 0021530 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% render_block "css" %}
some content
{% addtoblock "css" %}
my css file
{% endaddtoblock %}
more content
{% addtoblock "js" %}
my js file
{% endaddtoblock %}
final content
{% render_block "js" %}
django-sekizai-4.1.0/tests/templates/css.html 0000664 0000000 0000000 00000000241 14424226704 0021233 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% render_block "css-to-file" %}
{% addtoblock "css-to-file" %}
{% endaddtoblock %} django-sekizai-4.1.0/tests/templates/css2.html 0000664 0000000 0000000 00000000404 14424226704 0021316 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% render_block "css-onefile" %}
{% addtoblock "css-onefile" %}{% endaddtoblock %}
{% addtoblock "css-onefile" %}{% endaddtoblock %} django-sekizai-4.1.0/tests/templates/easy_base.html 0000664 0000000 0000000 00000000130 14424226704 0022373 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% render_block "css" %}
{% block main %}content{% endblock %} django-sekizai-4.1.0/tests/templates/easy_inherit.html 0000664 0000000 0000000 00000000117 14424226704 0023130 0 ustar 00root root 0000000 0000000 {% extends "easy_base.html" %}
{% block main %}{{ block.super }}{% endblock %} django-sekizai-4.1.0/tests/templates/eat.html 0000664 0000000 0000000 00000000132 14424226704 0021213 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% addtoblock "css" %}
my css file
{% endaddtoblock %}
mycontent django-sekizai-4.1.0/tests/templates/errors/ 0000775 0000000 0000000 00000000000 14424226704 0021074 5 ustar 00root root 0000000 0000000 django-sekizai-4.1.0/tests/templates/errors/failadd.html 0000664 0000000 0000000 00000000106 14424226704 0023343 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% addtoblock %}
file one
{% endaddtoblock %} django-sekizai-4.1.0/tests/templates/errors/failbase.html 0000664 0000000 0000000 00000000211 14424226704 0023522 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% render_block "js" %}
{% include "errors/failinc.html" %}
{% addtoblock "js" %}
file one
{% endaddtoblock %} django-sekizai-4.1.0/tests/templates/errors/failbase2.html 0000664 0000000 0000000 00000000211 14424226704 0023604 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% include "errors/failinc.html" %}
{% addtoblock "js" %}
file one
{% endaddtoblock %}
{% render_block "js" %} django-sekizai-4.1.0/tests/templates/errors/failinc.html 0000664 0000000 0000000 00000000112 14424226704 0023361 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% addtoblock "js %}
file two
{% endaddtoblock %} django-sekizai-4.1.0/tests/templates/errors/failrender.html 0000664 0000000 0000000 00000000053 14424226704 0024073 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% render_block %} django-sekizai-4.1.0/tests/templates/inherit/ 0000775 0000000 0000000 00000000000 14424226704 0021222 5 ustar 00root root 0000000 0000000 django-sekizai-4.1.0/tests/templates/inherit/base.html 0000664 0000000 0000000 00000000520 14424226704 0023017 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
head start
{% render_block "css" %}
head end
include start
{% include "inherit/baseinc.html" %}
include end
block main start
{% block "main" %}
block main base contents
{% endblock %}
block main end
body pre-end
{% render_block "js" %}
body end
{% addtoblock "css" %}
some css file
{% endaddtoblock %} django-sekizai-4.1.0/tests/templates/inherit/baseinc.html 0000664 0000000 0000000 00000000132 14424226704 0023510 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
inc add js
{% addtoblock "js" %}
inc js file
{% endaddtoblock %} django-sekizai-4.1.0/tests/templates/inherit/chain.html 0000664 0000000 0000000 00000000151 14424226704 0023167 0 ustar 00root root 0000000 0000000 {% extends "inherit/extend.html" %}
{% block "main" %}
{{ block.super }}
{{ other_var }}
{% endblock %} django-sekizai-4.1.0/tests/templates/inherit/extend.html 0000664 0000000 0000000 00000000301 14424226704 0023371 0 ustar 00root root 0000000 0000000 {% extends "inherit/base.html" %}
{% load sekizai_tags %}
{% addtoblock "css" %}
invisible css file
{% endaddtoblock %}
{% block "main" %}
{% include "inherit/extinc.html" %}
{% endblock %} django-sekizai-4.1.0/tests/templates/inherit/extinc.html 0000664 0000000 0000000 00000000040 14424226704 0023374 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
extinc
django-sekizai-4.1.0/tests/templates/inherit/nullbase.html 0000664 0000000 0000000 00000000000 14424226704 0023703 0 ustar 00root root 0000000 0000000 django-sekizai-4.1.0/tests/templates/inherit/nullext.html 0000664 0000000 0000000 00000000127 14424226704 0023603 0 ustar 00root root 0000000 0000000 {% extends "inherit/nullbase.html" %}
{% load sekizai_tags %}
{% render_block "js" %} django-sekizai-4.1.0/tests/templates/inherit/spacechain.html 0000664 0000000 0000000 00000000047 14424226704 0024207 0 ustar 00root root 0000000 0000000 {% extends "inherit/extend.html" %} django-sekizai-4.1.0/tests/templates/inherit/subvarchain.html 0000664 0000000 0000000 00000000045 14424226704 0024414 0 ustar 00root root 0000000 0000000 {% extends "inherit/varchain.html" %} django-sekizai-4.1.0/tests/templates/inherit/super_blocks.html 0000664 0000000 0000000 00000000370 14424226704 0024603 0 ustar 00root root 0000000 0000000 {% extends "inherit/base.html" %}
{% load sekizai_tags %}
{% addtoblock "css" %}
invisible css file
{% endaddtoblock %}
{% block "main" %}
{{ block.super }}
{% addtoblock "css" %}
visible css file
{% endaddtoblock %}
more contents
{% endblock %} django-sekizai-4.1.0/tests/templates/inherit/varchain.html 0000664 0000000 0000000 00000000023 14424226704 0023676 0 ustar 00root root 0000000 0000000 {% extends var %}
django-sekizai-4.1.0/tests/templates/named_end.html 0000664 0000000 0000000 00000000172 14424226704 0022360 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% addtoblock "myblock" %}
mycontent
{% endaddtoblock "myblock" %}
{% render_block "myblock" %}
django-sekizai-4.1.0/tests/templates/namespaces.html 0000664 0000000 0000000 00000000370 14424226704 0022565 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% render_block "one" %}
{% render_block "two" %}
{% addtoblock "one" %}
the same file
{% endaddtoblock %}
{% addtoblock "two" %}
the same file
{% endaddtoblock %}
{% addtoblock "one" %}
the same file
{% endaddtoblock %} django-sekizai-4.1.0/tests/templates/processors/ 0000775 0000000 0000000 00000000000 14424226704 0021762 5 ustar 00root root 0000000 0000000 django-sekizai-4.1.0/tests/templates/processors/addtoblock_namespace.html 0000664 0000000 0000000 00000000252 14424226704 0026771 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
header
{% addtoblock "js" preprocessor "tests.test_core.namespace_processor" %}
javascript
{% endaddtoblock %}
footer
{% render_block "js" %}
django-sekizai-4.1.0/tests/templates/processors/addtoblock_null.html 0000664 0000000 0000000 00000000245 14424226704 0026011 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
header
{% addtoblock "js" preprocessor "tests.test_core.null_processor" %}
javascript
{% endaddtoblock %}
footer
{% render_block "js" %}
django-sekizai-4.1.0/tests/templates/processors/namespace.html 0000664 0000000 0000000 00000000253 14424226704 0024604 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
header
{% addtoblock "js" %}
javascript
{% endaddtoblock %}
footer
{% render_block "js" postprocessor "tests.test_core.namespace_processor" %}
django-sekizai-4.1.0/tests/templates/processors/null.html 0000664 0000000 0000000 00000000246 14424226704 0023624 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
header
{% addtoblock "js" %}
javascript
{% endaddtoblock %}
footer
{% render_block "js" postprocessor "tests.test_core.null_processor" %}
django-sekizai-4.1.0/tests/templates/unique.html 0000664 0000000 0000000 00000000246 14424226704 0021756 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% render_block "unique" %}
{% addtoblock "unique" %}unique data{% endaddtoblock %}
{% addtoblock "unique" %}unique data{% endaddtoblock %}
django-sekizai-4.1.0/tests/templates/variables.html 0000664 0000000 0000000 00000000373 14424226704 0022421 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% addtoblock blockname %}
file two
{% endaddtoblock %}
{% addtoblock "one" %}
file two
{% endaddtoblock %}
{% addtoblock blockname|upper %}
file one
{% endaddtoblock %}
{% render_block "ONE" %}
{% render_block blockname %} django-sekizai-4.1.0/tests/templates/with_data.html 0000664 0000000 0000000 00000000251 14424226704 0022410 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% with_data "key" as mylist %}
{% for obj in mylist %}
{{ obj }}
{% endfor %}
{% end_with_data %}
{% add_data "key" 1 %}
{% add_data "key" 2 %} django-sekizai-4.1.0/tests/templates/with_data_basic.html 0000664 0000000 0000000 00000001411 14424226704 0023550 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% block title %}{% block pagetitle %}{% endblock pagetitle %}{% endblock title %}
{% with_data "google-fonts" as fonts %}{% if fonts %}
{% endif %}{% end_with_data %}
{% render_block "css" %}
{% block live_css %}{% endblock live_css %}
{% block head %}{% endblock head %}