[Checkins] SVN: hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/ Rewrite hurry.resource to fanstatic. Fix tests.
Jan-Jaap Driessen
jdriessen at thehealthagency.com
Fri Nov 26 09:39:38 EST 2010
Log message for revision 118597:
Rewrite hurry.resource to fanstatic. Fix tests.
Changed:
U hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/README.txt
U hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/tests/tests.py
U hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/tests/view.py
U hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/zcml.py
U hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/zopesupport.py
-=-
Modified: hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/README.txt
===================================================================
--- hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/README.txt 2010-11-26 14:39:11 UTC (rev 118596)
+++ hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/README.txt 2010-11-26 14:39:38 UTC (rev 118597)
@@ -26,7 +26,7 @@
>>> print browser.contents
<html>
<head>
- <script type="text/javascript" src="http://localhost/fanstatic/:hash:.../foo/a.js"></script>
+ <script type="text/javascript" src="http://localhost/fanstatic/foo/a.js"></script>
<BLANKLINE>
</head>
<body>
@@ -41,8 +41,8 @@
>>> print browser.contents
<html>
<head>
- <script type="text/javascript" src="http://localhost/fanstatic/:hash:.../foo/a.js"></script>
- <script type="text/javascript" src="http://localhost/fanstatic/:hash:.../foo/b.js"></script>
+ <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>
@@ -53,7 +53,6 @@
Let's force all javascript resources to be forced to be included at
the bottom now, just before the ``</body>`` tag::
- >>> import hurry.resource
>>> browser.open('http://localhost/hurry.zoperesource.test_bottom')
>>> print browser.contents
<html>
@@ -61,8 +60,8 @@
</head>
<body>
<p>the widget HTML itself</p>
- <script type="text/javascript" src="http://localhost/fanstatic/:hash:.../foo/a.js"></script>
- <script type="text/javascript" src="http://localhost/fanstatic/:hash:.../foo/b.js"></script></body>
+ <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
@@ -77,8 +76,8 @@
<head>
</head>
<body>
- <img src="http://localhost/fanstatic/:hash:.../foo/evencaveman.jpg" />
- <img src="http://localhost/fanstatic/:hash:.../foo/sub/evencaveman.jpg" />
+ <img src="http://localhost/fanstatic/foo/evencaveman.jpg" />
+ <img src="http://localhost/fanstatic/foo/sub/evencaveman.jpg" />
</body>
</html>
Modified: hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/tests/tests.py
===================================================================
--- hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/tests/tests.py 2010-11-26 14:39:11 UTC (rev 118596)
+++ hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/tests/tests.py 2010-11-26 14:39:38 UTC (rev 118597)
@@ -6,7 +6,8 @@
from zope.app.wsgi.testlayer import BrowserLayer
from zope.publisher.interfaces.browser import IBrowserRequest
-from hurry.resource.wsgi import InjectMiddleWare
+from fanstatic import InjectMiddleware
+
from hurry.zoperesource.zcml import create_factory
from hurry.zoperesource.tests.view import foo
import hurry.zoperesource.tests
@@ -22,7 +23,7 @@
resource_factory, (IBrowserRequest,), Interface, foo.name)
def setup_middleware(self, app):
- return InjectMiddleWare(app)
+ return InjectMiddleware(app)
def test_suite():
readme = doctest.DocFileSuite(
Modified: hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/tests/view.py
===================================================================
--- hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/tests/view.py 2010-11-26 14:39:11 UTC (rev 118596)
+++ hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/tests/view.py 2010-11-26 14:39:38 UTC (rev 118597)
@@ -1,4 +1,4 @@
-from hurry.resource import Library, ResourceInclusion, get_current_needed_inclusions
+from fanstatic import Library, ResourceInclusion, get_current_needed_inclusions
foo = Library("foo", "foo_dir")
Modified: hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/zcml.py
===================================================================
--- hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/zcml.py 2010-11-26 14:39:11 UTC (rev 118596)
+++ hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/zcml.py 2010-11-26 14:39:38 UTC (rev 118597)
@@ -1,7 +1,9 @@
from zope.interface import Interface
from zope import component
from zope.publisher.interfaces.browser import IBrowserRequest
-import hurry.resource
+
+import fanstatic
+
from hurry.zoperesource.zopesupport import HurryResource
def create_factory(library):
@@ -10,9 +12,9 @@
return factory
def action_setup(_context):
- """Publish all hurry.resource library entry points as resources.
+ """Publish all fanstatic library entry points as resources.
"""
- for library in hurry.resource.libraries():
+ for library in fanstatic.libraries():
factory = create_factory(library)
adapts = (IBrowserRequest,)
provides = Interface
Modified: hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/zopesupport.py
===================================================================
--- hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/zopesupport.py 2010-11-26 14:39:11 UTC (rev 118596)
+++ hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/zopesupport.py 2010-11-26 14:39:38 UTC (rev 118597)
@@ -5,11 +5,11 @@
from zope.traversing.browser.interfaces import IAbsoluteURL
from zope.traversing.interfaces import ITraversable
-import hurry.resource
+import fanstatic
@adapter(IEndRequestEvent)
def set_base_url_on_needed_inclusions(event):
- needed = hurry.resource.get_current_needed_inclusions()
+ needed = fanstatic.get_current_needed_inclusions()
if not needed.base_url:
needed.base_url = absoluteURL(None, event.request)
@@ -32,7 +32,7 @@
return HurryResource(self.request, self.library, name=name)
def __str__(self):
- needed = hurry.resource.get_current_needed_inclusions()
+ needed = fanstatic.get_current_needed_inclusions()
if not needed.base_url:
needed.base_url = absoluteURL(None, self.request)
return needed.library_url(self.library) + self.name
More information about the checkins
mailing list