FileSystemSite Metadata Files
FileSystemSite is a product used by Infrae's Silva content management system which allows zodb objects (e.g. PythonScripts, DTML Methods, PageTemplates) to be created on the filesystem. Any Silva extension that has views uses fssite, and that includes my extensions.
Every so often I find I need to add properties, normally added via the properties tab in the ZMI, to my fssite objects. Usually all I need is to make give an FSPythonScript proxy roles, so it can operate with the Manager role. But I can never remember how to do this! I have yet to find documentation on this. So, this is an attempt to create something.
Properties, including proxy roles, are set in a file separate from the fssite object (but in the same directory). For example, if I have a PythonScript named tab_template.py, it's properties will be set in the aptly-named tab_template.py.metadata. Near as I can tell, this file has the following format:
[default] name=value ... [security] Permission Name=(0|1):Role[,Role...]
Properties and proxy roles are set in the [default] section. Both types follow the standard name=value format. A default section with a title and proxy role setting might look like this:
[default] title=Title for PythonScript proxy=Manager,Anonymous
These property names can be any string. When setting the properties, a dictionary is created for the [default] section, and passed directly to self.__dict__.update. So you can set any property, even '__' ones. Be careful though! If you want to set fssite objects to be cacheable to a default Cache Manager (e.g. accelerated http cache manager), you need the following properties:
_Cacheable__enabled _Cacheable__manager_id
Using plain __manager_id isn't sufficient!
Permissions are set in the security section. The example shows the format of each property in this section. The Permission Name is the exact name of the permission. I believe it is case-sensitive. (0|1) specifies whether to acquire the permission setting. Role[,Role...] is a comma-delimited list of roles that will have this permission. A real (but short) example is:
[security] View=0:Authenticated
Which says for the View permission, don't acquire parent's permissions, and set the permission to Authenticated.