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 repoze.squeeze

How to install repoze.squeeze

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install repoze.squeeze
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.4.4 Available View build log
Windows (64-bit)
0.4.4 Available View build log
Mac OS X (10.5+)
0.4.4 Available View build log
Linux (32-bit)
0.4.4 Available View build log
Linux (64-bit)
0.4.4 Available View build log
 
License
BSD-derived (http://www.repoze.org/LICENSE.txt)
Imports
Lastest release
version 0.4.4 on Jan 5th, 2011

This package provides a WSGI middleware component which "squeezes" HTML documents by merging browser resources (javascript and stylesheets).

It uses statistical analysis to determine the optimal bundles based on the HTML documents that pass through it. Vary-headers are observed, as are resource expiration dates.

Documents that are not squeezed are given the 'no-cache' pragma in an expectation that we will be able to squeeze it after sufficient burn-in. Squeezed documents are served with expiration dates no later than the expiration dates of the squeezed resources which it references.

Usage

Configure the middleware with the following two options (required):

@cache_dir: Relative path to a directory where we store squeezed resources

@url_prefix: Path segment or full base URL that will be used to serve the cache directory as static files.

The following option is optional:

@threshold: Floating-point parameter that controls the merge to apperances threshold. This parameter can normally be left at the default (0.5).

In addition, you must configure the WSGI application to serve the file cache directory from the url_prefix (e.g. "cache").

Invalidation

To invalidate the file cache, upstream applications can set the "X-Squeeze-Invalidate" header to a true value; note that before the application is called, the middleware adds this key to the environment such that applications which can't modify the environment can still flag for invalidation:

>>> invalidate = environ["X-Squeeze-Invalidate"]
>>> invalidate()

This will reset the file cache registry; note that no cache files are ever deleted (to preserve web server integrity). You can manually purge the file cache at any time be deleting the files (this is allowed at run-time).

Changelog

0.4.4 (released 2009-06-22)
  • Fixed edge-case where a response would not have a character set

System Message: WARNING/2 (<string>, line 63)

Bullet list ends without a blank line; unexpected unindent.

defined and hence couldn't be expressed as unicode. [malthe]

  • Fixed edge-case with self-closing style elements. [malthe]
  • Fixed edge-case issue with missing ttl-value. [malthe]
0.4.3 (released 2009-05-11)
  • Added environment variable control of file cache

System Message: WARNING/2 (<string>, line 73)

Bullet list ends without a blank line; unexpected unindent.

invalidation. [malthe]

0.4.2 (released 2009-05-11)
  • Add semicolon after javascripts to make sure any function-block is

System Message: WARNING/2 (<string>, line 79)

Bullet list ends without a blank line; unexpected unindent.

properly terminated (necessary due to concatenation). [malthe]

0.4.1 (released 2009-04-20)
  • Parse unicode body to ensure correct character decoding. [malthe]
0.4 (released 2009-04-15)
  • If a response has status '304 Not Modified', update the ttl but

System Message: WARNING/2 (<string>, line 90)

Bullet list ends without a blank line; unexpected unindent.

not the content. [malthe]

  • If a script- or style-tag does not have a source or link, ignore

System Message: WARNING/2 (<string>, line 93)

Bullet list ends without a blank line; unexpected unindent.

it. [malthe]

  • Unquote request URL when querying cache. [malthe]
  • Added support for repoze.xmliter which allows reusing an

System Message: WARNING/2 (<string>, line 98)

Bullet list ends without a blank line; unexpected unindent.

lxml document tree between middlewares. [malthe]

  • Media types for stylesheets are now taken into account when merging

System Message: WARNING/2 (<string>, line 101)

Bullet list ends without a blank line; unexpected unindent.

the resources. Squeze uses CSS2 @media <type> syntax. [jvloothuis]

0.3 (released 2008-10-08)
  • Relative URLs appearing in stylesheets are now made absolute before

System Message: WARNING/2 (<string>, line 107)

Bullet list ends without a blank line; unexpected unindent.

merging. [malthe]

0.2 (released 2008-10-03)
  • Add setuptools as a dependency. [malthe]
0.1 (released 2008-10-02)
  • Initial release.

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:1

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.