Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install z3c.resourceinclude

How to install z3c.resourceinclude

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install z3c.resourceinclude
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.3.1 Available View build log
Windows (64-bit)
0.3.1 Available View build log
Mac OS X (10.5+)
0.3.1 Available View build log
Linux (32-bit)
0.3.1 Available View build log
Linux (64-bit)
0.3.1 Available View build log
 
Author
License
ZPL
Depended by
Lastest release
version 0.3.1 on Jan 5th, 2011

Overview

The package is able to include the following types of resources:

  • Cascading stylesheets (.css)
  • Kinetic stylesheets (.kss)
  • Javascript (.js)

Usage

The package operates with browser resources, registered individually or using the resource directory factory.

A simple example:

<configure xmlns="http://namespaces.zope.org/zope"

System Message: ERROR/3 (<string>, line 21)

Inconsistent literal block quoting.

xmlns:browser="http://namespaces.zope.org/browser">

<include package="z3c.resourceinclude" file="meta.zcml" /> <include package="z3c.resourceinclude" />

<browser:resource name="example.css" file="example.css" />

<browser:resourceInclude layer="zope.publisher.interfaces.browser.IDefaultBrowserLayer" include="example.css" />

</configure>

This registration means that whenever the request provides IDefaultBrowserLayer the resource named 'example.css' will be included on the page.

To render HTML snippets that include applicable resources, a content provider is provided, see z3c/resourceinclude/provide.py. You may also use one of the viewlets:

<browser:viewlet

System Message: ERROR/3 (<string>, line 45)

Inconsistent literal block quoting.

name="resourceinclude" class="z3c.resourceinclude.viewlets.CacheOneHourViewlet" permission="zope.View" />

A convenience method is provided to require a given resource layer:

>>> from z3c.resourceinclude import include
>>> include(IMyLayer)

Ordering

Resources are included in the order they're registered; that is, the order in which the ZCML-directives are processed.

Stylesheets are included before javascripts as per general recommendation. Kinetic stylesheets are included last.

Merging

When not in 'devmode', the resource collector will automatically merge resources, giving them a filename based on the contents (sha digest). This has the side effect that merged resources are set to never expire.

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:2

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.