[Zope3-Users] How to set "content-coding" for a browser resource?

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu May 15 22:39:16 EDT 2008


On Sunday 04 May 2008, nixon wrote:
> I configured a reource folder, in which I dropped a gzipped javascript
> file. When fetching from server, it seems not to be unzipped.
> Is it possible to configure the content-coding for such static resource
> response? Or must I do it like a normal view?

I am pretty sure the default resource is pretty ignorant about compressed 
content. You can always write your own resource, like this::

  class ZippedResource(SomeBaseResource):
      filename = None
      ...

  ZippedJQuery = type('ZippedJQuery', (ZippedResource,),
      {'filename': 'jquery.js.zip'})

and in ZCML:

  <adapter
      factory="ZippedJQuery"
      permission="zope.View" />

Regards,
Stephan
-- 
Stephan Richter
Web Software Design, Development and Training
Google me. "Zope Stephan Richter"


More information about the Zope3-users mailing list