zope.fanstatic

Software Screenshot:
zope.fanstatic
Software Details:
Version: 0.12
Upload Date: 11 May 15
Distribution Type: Freeware
Downloads: 2

Rating: nan/5 (Total Votes: 0)

The zope.fanstatic package provides Zope integration for Fanstatic. This means it's taking care of two things:

 * provide access to the needed resources throughout the request/response cycle.
 * provide the base URL for the resources to be rendered.

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.app.wsgi.testlayer import Browser
 > > > browser = Browser()
 > > > browser.handleErrors = False
 > > > browser.open('http://localhost/zope.fanstatic.test_single')
 > > > print browser.contents
< html >
< head >
< script type="text/javascript" src="http://localhost/fanstatic/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/zope.fanstatic.test_multiple')
 > > > print browser.contents
< html >
< head >
 < script type="text/javascript" src="http://localhost/fanstatic/foo/a.js" >< /script >
 < script type="text/javascript" src="http://localhost/fanstatic/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/zope.fanstatic.test_bottom')
 > > > print browser.contents
< html >
< head >
< /head >
< body >
< p >the widget HTML itself< /p >
< script type="text/javascript" src="http://localhost/fanstatic/foo/a.js" >< /script >
< script type="text/javascript" src="http://localhost/fanstatic/foo/b.js" >< /script >< /body >
< /html >


In-template resources

zope.fanstatic provides support for rendering resource publisher aware URLs to in-template resources:

 > > > browser.open('http://localhost/zope.fanstatic.test_inline_resource')
 > > > print browser.contents
< html >
< head >
< /head >
< body >
 < img src="http://localhost/fanstatic/foo/evencaveman.jpg" / >
 < img src="http://localhost/fanstatic/foo/sub/evencaveman.jpg" / >
< /body >
< /html >

What is new in this release:

  • Similar to the fix in 0.11, make sure calling for the URL of a resource will not failed for a DummyNeededResources object which would badly hurt testability of function or "browser" tests of applications that depend on fanstatic/zope.fanstatic.

What is new in version 0.11:

  • Fix bug where calling ensure_base_url() failed for DummyNeededResources objects. This was problematic when writing functional or "browser" tests of applications that depend on fanstatic/zope.fanstatic.

What is new in version 0.10:

  • Update to fanstatic 0.11 API.

What is new in version 0.9.1:

  • Do not clear resources on DummyNeededResources objects.

What is new in version 0.9 Beta:

  • Compliance with the Fanstatic API.
  • ++resource++foo/bar/baz.jpg expressions in Page Templates are still supported by way registering a traversable component for all available resource libraries. There are no zope.browserresource components involved anymore in zope.fanstatic.

Requirements:

  • Python

Other Software of Developer Zope Corporation and Contributors

zope.dublincore
zope.dublincore

12 May 15

zope.html
zope.html

14 Apr 15

Products.ZNagios
Products.ZNagios

11 May 15

zope.errorview
zope.errorview

11 May 15

Comments to zope.fanstatic

Comments not found
Add Comment
Turn on images!