Personal tools
Skip to content. | Skip to navigation
This package lets you mark the request with a "layer" interface conditional on the currently selected skin (theme) in the portal_skins tool. Most Zope 3 "visual" directives, like <browser:page /> or <browser:viewlet /> accept a 'layer' attribute, which should point to an interface. Recall that a view is a multi-adapter on (context, request). Most views are registered so that the 'request' being adapted only needs to provide Interface. This is equivalent to saying layer="*". By applying a marker interface to the request, and registering a view or viewlet with this interface as the adapted 'layer', we can override a more general view, or make a viewlet that is only shown for a particular layer. In the context of CMF and Plone, we'd like to tie the layer to the current skin selection. We do that by name. What you have to do First, you should create a marker interface: >>> from zope.interface import Interface >>> class IMyTheme(Interface): ... """Marker interface for skins part of 'My Theme' ... """ Then, register this as a theme layer in ZCML: <interface interface=".interfaces.IMyTheme" type="zope.publisher.interfaces.browser.IBrowserSkinType" name="My Theme" /> The title here must match the name of the theme/skin selection in portal_skins. How it works Behind the scenes, the <interface /> registration marks IMyTheme with the "IInterface" IThemelayer, and registers IMyTheme as a utility named "My Theme" and providing IBrowserSkinType. We do something to this effect in tests/tests.zcml. Let us define the "My Theme" skin selection: >>> from Products.CMFCore.utils import getToolByName >>> portal_skins = getToolByName(self.portal, 'portal_skins') >>> default_skin = portal_skins.getDefaultSkin() >>> skin_path = portal_skins._getSelections()[default_skin] >>> portal_skins.addSkinSelection('My Theme', skin_path) In tests/tests.zcml we have registered two version of a view called @@layer-test-view. One, for the default skin layer, simply outputs "Default". The other outputs "My Theme". Before we turn on the skin, we will get the default view. >>> from Products.Five.testbrowser import Browser >>> browser = Browser() >>> browser.open(self.portal.absolute_url() + '/@@layer-test-view') >>> print browser.contents Default However, if we turn the skin on, we should see the effects of the marker interface being applied. >>> portal_skins.default_skin = 'My Theme' >>> browser.open(self.portal.absolute_url() + '/@@layer-test-view') >>> print browser.contents My Theme And if we switch back: >>> portal_skins.default_skin = 'Plone Default' >>> browser.open(self.portal.absolute_url() + '/@@layer-test-view') >>> print browser.contents Default
For the purposes of this package, a tile is a browser view and an associated utility providing some metadata about that view. The metadata includes a title and description, an 'add' permission and optionally a schema interface describing configurable aspects of the tile. The idea is that a UI (such as Deco) can present the user with a list of insertable tiles and optionally render a form to configure the tile upon insertion. A tile is inserted into a layout as a link: <link rel="tile" target="placeholder" href="./@@sample.tile/tile1?option1=value1" /> The sub-path (tile1` in this case) is used to set the tile id attribute. This allows the tile to know its unique id, and, in the case of persistent tiles, look up its data. sample.tile is the name of the browser view that implements the tile. This is made available as the __name__ attribute. Other parameters may be turned into tile data, available under the data attribute, a dict, for regular tiles. For persistent tiles (those deriving from the PersistentTile base class), the data is fetched from annotations instead, based on the tile id. There are three interfaces describing tiles in this package: * IBasicTile is the low-level interface for tiles. It extends IBrowserView to describe the semantics of the __name__ and id attributes. * ITile describes a tile that can be configured with some data. The data is accessible via a dict called data. The default implementation of this interface, plone.tiles.Tile, will use the schema of the tile type and the query string (self.request.form) to construct that dictionary. This interface also describes an attribute url, which gives the canonical tile URL, including the id sub-path and any query string parameters. (Note that tiles also correctly implement IAbsoluteURL.) * IPersistentTile describes a tile that stores its configuration in object annotations, and is needed when configuration values cannot be encoded into a query string. The default implementation is in plone.tiles.PersistentTile. To make it possible to have several tiles of a given type on the same layout, the annotations are keyed by the tile __name__. In addition, tiles are described by ITileType, which contains attributes for the tile name, title, description, add permission and schema (if required). A properly configured tile, then, consists of a browser view providing IBasicTile or one of its derivatives, and a utility providing ITileType with the same name as the tile browser view. There is a convenience ZCML directive - <plone:tile /> - to register both of these components in one go. To support creation of appropriate tile links, plone.tiles.data contains two methods - encode() and decode() - to help turn a data dictionary into a query string and turn a request.form dict into a data dict that complies with a tile's schema interface.
Hook into repoze.zope2 that allows third party packages to register a sequence of hooks that will be allowed to modify the response before it is returned to the browser
UUIDs for content items
plone.z3cform is a library that allows use of z3c.form with Zope 2 and the CMF.
The package aims to backport the auto CSRF implementation from Plone 5 to Plone 4. The reason this is necessary is because there are a lot of CSRF problem with the ZMI that Zope2 will never be able to fix. See https://plone.org/products/plone/security/advisories/security-vulnerability-20151006-csrf for more details.
Base p4a module
Upload a normal File to your Plone site, and Plone4ArtistsAudio will detect it as an MP3 or Ogg file and "decorate" it with metadata.
The p4a.calendar package is a package for producing calendars from collection of events. Features include: Monthly, Weekly, Daily view Any calendar activated (smart) folder can has several default views including a monthly, weekly and daily view. Chronological event view The events gathered together by the activated calendar can be displayed using a chronological event listing. Past events view Events that have already occurred are grouped into a past events listing page. Color coding by event type Events can be color coded based on what event type (keyword) they have been assigned.
Reusable code-bits for Zope 3 and Plone