-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add entrypoint, bobregistry and docs for subscriber template
- Loading branch information
Showing
5 changed files
with
129 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
========================= | ||
Subscriber sub-template | ||
========================= | ||
|
||
.. topic:: Description | ||
|
||
Adding a subscriber to an existing add-on package. | ||
|
||
|
||
With this sub-template, you can add an event subscriber (handler) to a Plone add-on package. | ||
|
||
First create a Plone add-on package: | ||
|
||
.. code-block:: shell | ||
mrbob -O collective.todo bobtemplates.plone:addon | ||
then change into the created folder ``collective.todo`` and create your first View: | ||
|
||
.. code-block:: shell | ||
mrbob bobtemplates.plone:subscriber | ||
It will ask you for the subscriber handler file name and then creates this file in the subscribers folder. This file contains a handler method which you customize to your needs. | ||
|
||
|
||
Example | ||
======= | ||
|
||
.. code-block:: shell | ||
$ cd collective.todo | ||
Add a subscriber | ||
---------------------------- | ||
|
||
.. code-block:: shell | ||
$ mrbob bobtemplates.plone:subscriber | ||
Welcome to mr.bob interactive mode. Before we generate directory structure, some questions need to be answered. | ||
Answer with a question mark to display help. | ||
Values in square brackets at the end of the questions show the default value if there is no answer. | ||
RUN: git status --porcelain --ignore-submodules | ||
Git state is clean. | ||
--> Subscriber handler file name (without extension) [obj_modified_do_something]: obj_mod_clear_cache | ||
>>> reading Plone version from bobtemplate.cfg | ||
rename example zcml file | ||
Should we run?: | ||
git add . | ||
git commit -m "Add subscriber: obj_mod_clear_cache" | ||
in: /home/maik/develop/src/bobtemplates.plone/tmp/collective.todo | ||
[y]/n: | ||
RUN: git add . | ||
RUN: git commit -m "Add subscriber: obj_mod_clear_cache" | ||
[master 53d7e16] "Add subscriber: obj_mod_clear_cache" | ||
5 files changed, 47 insertions(+) | ||
create mode 100644 src/collective/todo/subscribers/__init__.py | ||
create mode 100644 src/collective/todo/subscribers/configure.zcml | ||
create mode 100644 src/collective/todo/subscribers/obj_mod_clear_cache.py | ||
create mode 100644 src/collective/todo/tests/test_subscriber_obj_mod_clear_cache.py | ||
Generated file structure at /home/maik/develop/src/bobtemplates.plone/tmp/collective.todo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,6 @@ lines_after_imports = 2 | |
line_length = 200 | ||
not_skip = | ||
__init__.py | ||
|
||
skip = | ||
|
||
[flake8] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters