https://github.com/zopefoundation/z3c.jbot
Drop-in template overrides.
https://github.com/zopefoundation/z3c.jbot
Last synced: 8 months ago
JSON representation
Drop-in template overrides.
- Host: GitHub
- URL: https://github.com/zopefoundation/z3c.jbot
- Owner: zopefoundation
- License: other
- Created: 2013-03-02T01:43:19.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2025-08-05T00:38:54.000Z (10 months ago)
- Last Synced: 2025-08-30T18:44:30.660Z (9 months ago)
- Language: Python
- Homepage:
- Size: 271 KB
- Stars: 2
- Watchers: 62
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
- Contributing: CONTRIBUTING.md
- License: LICENSE.rst
Awesome Lists containing this project
README
Overview
========
The ``z3c.jbot`` (or "Just a bunch of templates") package allows easy
customization of existing templates and images. It works on Zope 2 and
Zope 3.
The Chameleon rendering engine is supported.
Use of this package adds a small (2-3 ms per request on Plone) to the
total application response time.
Usage
-----
To override a particular file, first determine its *canonical
filename*. It's defined as the path relative to the package within
which the file is located; directory separators are replaced with
dots.
Example:
Suppose you want to override: /plone/app/layout/viewlets/logo.pt
You would use the filename: plone.app.layout.viewlets.logo.pt
Simply drop the file in a directory and register that directory for
use with jbot using a ZCML-directive::
Templates in views, viewlets and portlets
-----------------------------------------
Any template that is defined as a class-attribute can be overriden
using jbot, e.g. those used in views, viewlets and portlets. The
template overrides may be registered for any request layer or only a
specific layer.
CMF objects
-----------
Any skin-object (e.g. images, templates) on the file system (directory
views) can be overridden.
Plone resources
---------------
If `plone.resource` is installed, it's possible to use jbot to
override filesystem resources.
Deprecation warnings
--------------------
Imagine this situation:
* You have a ``base`` package with a page template ``original.pt``.
* Someone else overrides this in a project specific package by creating a file ``base.original.pt``.
* Now for some reason you rename the template to ``new.pt``.
* The template override in the project no longer works and the other person starts asking questions or complaining.
To solve this problem, you can register that a template path is deprecated.
First add a dictionary to the ``base`` package, let's say in a file ``utils.py``::
deprecated_templates = {
"base.original.pt": "base.new.pt",
}
In your ``configure.zcml`` you add::
...
The result is:
1. The old override ``base.original.pt`` works for the new location as well.
2. The user gets a warning that they should use ``base.new.pt`` instead.
Author
------
Malthe Borch