This release is a pre-release and may not be stable for production use.
Tau SelectorStrings
Introduction
The purpose of this component distribution is two-fold; to provide a useful way of configuring clusters of strings to be presented in a dropdown list, and to teach others how to create new ZCML directives. The code has been carefully documented to make it clear how it works.
My need for selectorstrings comes from another component I’m designing for presenting collections of various files as a Zope folder. I wanted to allow the developer who adds an instance of this document folder, using the ZMI (Zope Management Interface), to pick from a list of directories. I did not want them to be able to enter arbitrary directories, partly as a security precaution and partly to prevent typing errors.
This resulted in the following ZCML directive:
<selectorstring cluster="sitedocs"
label="Public Documents"
value="/usr/share/public/"
/>
<selectorstring cluster="sitedocs"
label="Family Photos"
value="/home/jeff/photos/"
/>
And you can add more, using the same or difference cluster name and the strings will be available as a Zope vocabulary under that cluster name.
One drawback is that each such simple directive repeats the cluster name repeatedly. So next I created a complex (nested) directive to factor out the cluster name:
<selectorcluster name="sitedocs">
<selectorstring
label="Public Documents"
value="/usr/share/public/"
/>
<selectorstring
label="Family Photos"
value="/home/jeff/photos/"
/>
</selectorcluster>
Steps to Creating a New ZCML Directive
ZCML directives come in two flavors, simple and complex. A simple directive stands alone but a complex one supports grouping by containing one or more other ZCML directives.
A new ZCML directive, either simple or complex, is described by four pieces:
its name
the namespace it belongs to
the schema
its directive handler
The piece that ties these all together is the declaration of the (simple-kind of) directive in the meta.zcml file:
<meta:directive
name="selectorstring"
schema=".interfaces.ISelectorStringDirective"
handler=".zcml_directives.selectorstring_SimpleDirectiveHandler"
/>
That takes care of declaring the name of the new directive and placing that name into the “zope” namespace. It could have placed it into the “browser” namespace or some other space that would make organizational sense.
To declare a complex-kind of directive:
<meta:complexDirective
name="selectorcluster"
schema=".interfaces.ISelectorClusterDirective"
handler=".zcml_directives.selectorcluster_ComplexDirectiveHandler"
>
<meta:subdirective
name="selectorstring"
schema=".interfaces.ISelectorStringSubdirective"
/>
</meta:complexDirective>
Using Your ZCML Directive
Like any ZCML directive, you place it into a configure.zcml file or some other file included your the top-level site.zcml configuration file:
<configure
xmlns="http://namespaces.zope.org/zope">
<selectorstring cluster="sitedocs"
label="Public Documents"
value="/usr/share/public/"
/>
</configure>
CHANGES
Version 0.1dev (2010-12-21)
Initial Release
Metadata
Release files for tau.selectorstrings 0.1dev
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 |
|---|---|---|---|---|
| tau.selectorstrings-0.1dev.tar.gz | 16.2 kB | Without provenance | Details for tau.selectorstrings-0.1dev.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tau.selectorstrings-0.1dev-py2.6.egg | Legacy Egg format | - | - | Details for tau.selectorstrings-0.1dev-py2.6.egg |
Total release size: 32.0 kB
Release files / tau.selectorstrings-0.1dev.tar.gz
| Download URL | tau.selectorstrings-0.1dev.tar.gz |
|---|---|
| Size | 16.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
19ee7dd8cc271fe9c682583228dad1b1c24f668217f827c3814aef456b1c4a9e
|
|
BLAKE2b-256 checksum How to use checksums |
65d67efcbc6e3b634fe169cad87026d6b7deebe38bad5c3d966c724a210e954d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / tau.selectorstrings-0.1dev-py2.6.egg
| Download URL | tau.selectorstrings-0.1dev-py2.6.egg |
|---|---|
| Size | 15.8 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
4a64b5a6d307ee1b1efcf547a14e3b39ac788d65e80610dcac0c56207e36ef5d
|
|
BLAKE2b-256 checksum How to use checksums |
e38b96453f368230b362eba16f5ba45275690344ba5b1e44fc61cddae8b743d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for tau.selectorstrings 0.1dev
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.