This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Zope integration for hurry.resource

Important

hurry.zoperesource has been superseded by zope.fanstatic

This package provides Zope integration for hurry.resource. This means it’s taking care of three things:

  • maintain the needed resources throughout the request/response cycle.
  • know how to make a URL to a resource.
  • make so that resource references are automatically inserted in the HTML header.

This library fulfills these conditions for a Zope Toolkit/Grok setup.

We’ll run through a few tests to demonstrate it. Note that the real code being tested is not in this document itself, but in the views described in ftesting.zcml.

We need to be in a request to make this work, so let’s up a request to a page we have set up in ftesting.zcml that should cause the inclusion of a single resource in its header:

>>> from zope.testbrowser.testing import Browser
>>> browser = Browser()
>>> browser.handleErrors = False
>>> browser.open('http://localhost/hurry.zoperesource.test_single')
>>> print browser.contents
<html>
<head>
    <script type="text/javascript" src="http://localhost/@@/foo/a.js"></script>
<BLANKLINE>
</head>
<body>
<p>the widget HTML itself</p>
</body>
</html>

If a resource happens to need another resource, this resource is also automatically included:

>>> browser.open('http://localhost/hurry.zoperesource.test_multiple')
>>> print browser.contents
<html>
<head>
    <script type="text/javascript" src="http://localhost/@@/foo/a.js"></script>
  <script type="text/javascript" src="http://localhost/@@/foo/b.js"></script>
<BLANKLINE>
</head>
<body>
<p>the widget HTML itself</p>
</body>
</html>

Let’s force all javascript resources to be forced to be included at the bottom now, just before the </body> tag:

>>> browser.open('http://localhost/hurry.zoperesource.test_bottom')
>>> print browser.contents
<html>
<head>
</head>
<body>
<p>the widget HTML itself</p>
<script type="text/javascript" src="http://localhost/@@/foo/a.js"></script>
<script type="text/javascript" src="http://localhost/@@/foo/b.js"></script></body>
</html>

CHANGES

Important

hurry.zoperesource has been superseded by zope.fanstatic

0.7 (2010-10-01)

  • Created ResourceDirectories now are registered for IBrowserRequest the base class of the previously used IDefaultBrowserLayer. So this package can be used when the layer used by the application does not extend IDefaultBrowserLayer, as e. g. z3c.layer.pagelet does.

0.6 (2010-07-29)

  • Update to work with hurry.resource 0.10 and later. This uses the entry point mechanism to configure any libraries.

    Note that this needs hurry.resource-based packages that themselves have been updated to hurry.resource 0.10’s way of defining an entry point and including the resource path in the library. See the hurry.resource documentation for more information.

0.5 (2010-07-24)

  • Drop the zope.app.component dependency.
  • Register the ILibraryUrl adapter for ILibrary instead of Library, to be less specific for the adapter lookup.
  • Clearly specify license as ZPL.

0.4 (2009-12-16)

  • Updated required packages.
  • Use a newer version of hurry.resource which can insert the snippets into HTML itself.

0.3 (2008-12-05)

  • resource.need() needed a request object set up in order to function. This is rather annoying in tests, which often don’t have a request object set up. We now instead return a dummy NeededResources object in such cases (which will then be thrown away). As a result, it’s always safe to call resource.need() during tests, though if no request can be found it will have no effect.

0.2 (2008-10-13)

  • Add support for rendering fragments at the bottom of the page. When you call hurry.resource.bottom resources which are marked bottom-safe will be rendered at the bottom of the web page instead of in the <head> section. When you call hurry.resource.bottom(force=True), all .js resources will be included at the bottom.

0.1 (2008-10-11)

  • Initial public release.

Download

Release History

Release History

0.8

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.7

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting