[Checkins] SVN: Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ First shot

Christian Klinger cklinger at novareto.de
Thu Nov 19 11:32:33 EST 2009


Log message for revision 105882:
  First shot 

Changed:
  U   Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/README.txt
  U   Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/__init__.py
  U   Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/components.py
  U   Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/configure.zcml
  U   Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/directive.py
  U   Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/event.py
  D   Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_depends.py
  D   Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_hashedresource.py
  D   Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_inclusion.py
  A   Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_mf.py
  D   Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_readme.py
  D   Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/utils.py

-=-
Modified: Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/README.txt
===================================================================
--- Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/README.txt	2009-11-19 16:31:33 UTC (rev 105881)
+++ Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/README.txt	2009-11-19 16:32:32 UTC (rev 105882)
@@ -65,7 +65,6 @@
 
   >>> class MyView(view.View):
   ...     grok.context(Application)
-  ...     view.template('templates/myview.pt')
   ...     include(MyStyles, 'myjs')
 
   >>> grok.testing.grok_component('MyView', MyView)
@@ -79,3 +78,4 @@
   >>> myview
   <megrok.resource.ftests.MyView object at ...>
 
+  >>> myview()

Modified: Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/__init__.py
===================================================================
--- Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/__init__.py	2009-11-19 16:31:33 UTC (rev 105881)
+++ Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/__init__.py	2009-11-19 16:32:32 UTC (rev 105882)
@@ -1,2 +1,4 @@
 from directive import *
 from components import *
+from grokcore.view import path
+from grokcore.component import name

Modified: Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/components.py
===================================================================
--- Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/components.py	2009-11-19 16:31:33 UTC (rev 105881)
+++ Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/components.py	2009-11-19 16:32:32 UTC (rev 105882)
@@ -2,55 +2,33 @@
 
 import grokcore.component as grok
 
-
-from grokcore.view.components import DirectoryResource
-from hurry.resource import ResourceInclusion
-from hurry.resource.interfaces import ILibraryUrl
+from zope.interface import Interface
 from hurry.zoperesource.zopesupport import getRequest
-from megrok.resource.directive import inclusion
-from zope import component
+from grokcore.view.components import DirectoryResource
+from megrok.resource import not_hashed
+from zope.component import getAdapter, getMultiAdapter
+from z3c.hashedresource.interfaces import IResourceContentsHash
 from zope.app.component.hooks import getSite
-from zope.traversing.browser.absoluteurl import AbsoluteURL
 from zope.traversing.browser.interfaces import IAbsoluteURL
+from hurry.resource.interfaces import ILibraryUrl
+from zope.interface import directlyProvides
 
 
-def inclusions(cls):
-    keys = []
-    values = []
-    resources = inclusion.bind().get(cls)
-    for name, file, depends, bottom in resources:
-        keys.append(name)
-        values.append(
-            ResourceInclusion(cls, file, depends=depends, bottom=bottom)
-            )
-    return keys, values
-
-
 class Library(DirectoryResource):
     grok.baseclass()
-    
-    _ri_keys = None
-    _resources = None
 
-    @classmethod
-    def get_resources(cls, name=None):
-        """ cls._resources is a dict with the name of the inclusion as key
-            and the instance of a ResourceInclusion as value
-        """    
-        if cls._resources == None:
-            cls._ri_keys, values = inclusions(cls)
-            cls._resources = dict(zip(cls._ri_keys, values))
-        if name is not None:
-            return [cls._resources[name],]
-        return [cls._resources[name] for name in cls._ri_keys]
 
-    @classmethod
-    def get(cls, value):
-        return cls.get_resources(value)[0]
-
- at grok.adapter(Library)
+ at grok.adapter(Interface)
 @grok.implementer(ILibraryUrl)
 def library_url(library):
-    print "libraryurl from component"
     request = getRequest()
-    return "%s/@@/%s" % (AbsoluteURL(getSite(), request), library.name)
+    nothashed = not_hashed.bind().get(library)
+    resource = getAdapter(request, name=library.name)
+    hash = IResourceContentsHash(resource)
+    base_url = getMultiAdapter((getSite(), request), IAbsoluteURL)
+    url = '%s/++noop++%s/@@/%s' % (base_url, hash, library.name)
+
+    if nothashed:
+       url = str(getMultiAdapter((getSite(), request),
+                                         IAbsoluteURL)) + '/@@/' + library.name
+    return url

Modified: Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/configure.zcml
===================================================================
--- Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/configure.zcml	2009-11-19 16:31:33 UTC (rev 105881)
+++ Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/configure.zcml	2009-11-19 16:32:32 UTC (rev 105882)
@@ -7,10 +7,9 @@
     <include package="grokcore.component" file="meta.zcml" />
     <include package="hurry.zoperesource" />
     <include package="z3c.hashedresource" />
-    <include package="z3c.hashedresource" />
     <grok:grok package=".event" />
+    <grok:grok package=".components" />
     <grok:grok package=".meta" />
-    <grok:grok package=".utils" />
 
 </configure>
 

Modified: Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/directive.py
===================================================================
--- Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/directive.py	2009-11-19 16:31:33 UTC (rev 105881)
+++ Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/directive.py	2009-11-19 16:32:32 UTC (rev 105882)
@@ -11,7 +11,7 @@
     return factory.__name__.lower()
 
 
-class hashed(martian.MarkerDirective):
+class not_hashed(martian.MarkerDirective):
     scope = martian.CLASS_OR_MODULE
 
 
@@ -29,3 +29,7 @@
     
     def factory(self, value, name=None, bottom=False):
         return (value, name, bottom)
+
+class need(martian.Directive):
+    scope = martian.CLASS
+    store = martian.MULTIPLE

Modified: Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/event.py
===================================================================
--- Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/event.py	2009-11-19 16:31:33 UTC (rev 105881)
+++ Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/event.py	2009-11-19 16:32:32 UTC (rev 105882)
@@ -6,7 +6,7 @@
 
 from zope.app.publication.interfaces import IBeforeTraverseEvent
 from zope.security.proxy import removeSecurityProxy
-from megrok.resource import include
+from megrok.resource import include, need
 from hurry.resource import ResourceInclusion
 
 
@@ -14,17 +14,6 @@
 def handle_inclusion(view, event):
     with_bottom = False
     view = removeSecurityProxy(view)
-    includes = include.bind().get(view)
-    for lib, name, bottom in includes:
-        if bottom:
-            with_bottom=True
-
-        if isinstance(lib, ResourceInclusion):
-            lib.need()
-        else:
-            resources = lib.get_resources(name=name)
-            for resource in resources:
-                resource.need()
-
-    if with_bottom:
-        hurry.resource.bottom()
+    needs = need.bind().get(view)
+    for lib in needs:
+        lib.need()

Deleted: Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_depends.py
===================================================================
--- Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_depends.py	2009-11-19 16:31:33 UTC (rev 105881)
+++ Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_depends.py	2009-11-19 16:32:32 UTC (rev 105882)
@@ -1,134 +0,0 @@
-"""
-megrok.resource
-===============
-
-Setup
------
-
-  >>> from zope.app.testing.functional import getRootFolder
-  >>> from zope.app.container import btree
-  >>> from zope.app.component.site import LocalSiteManager
-  >>> from zope.app.component.hooks import setSite
-
-  >>> root = getRootFolder()
-  >>> root['newapp'] = Application()
-
-Our application has to be a Site to access the right url for the inclusions
-
-  >>> root['newapp'].setSiteManager(LocalSiteManager(root['newapp']))
-  >>> setSite(root['newapp'])
-  >>> root['newapp']
-  <megrok.resource.ftests.test_depends.Application object at ...>
-
-
-Inclusion with dependency from a megrok.resource Library
---------------------------------------------------------
-
-Now let's look if we can include the a.js File in a
-
-  >>> from zope.testbrowser.testing import Browser
-  >>> browser = Browser()
-  >>> browser.handleErrors = False 
-  >>> browser.open('http://localhost/newapp/depends')
-  >>> print browser.contents
-  <html>
-    <head>
-      <script type="text/javascript" src="http://localhost/newapp/@@/basestyles/a.js"></script>
-      <script type="text/javascript" src="http://localhost/newapp/@@/newstyles/b.js"></script>
-   </head>
-    <body>
-       <h1> HI GROK </h1>
-    </body>
-  </html>  
-
-
-Inclusion with a dependency from a hurry.core package
-here we use hurry.jquery
-
-  >>> browser.open('http://localhost/newapp/withjquery')
-  >>> print browser.contents
-  <html>
-    <head>
-      <script type="text/javascript" src="http://localhost/newapp/@@/jquery/jquery-1.3.2.js"></script>
-  <script type="text/javascript" src="http://localhost/newapp/@@/newstyles/b.js"></script>
-   </head>
-    <body>
-       <h1> HI GROK </h1>
-    </body>
-  </html>  
-
-Here we include only hurry.jquery with no inclusion from megrok.resource.
-
-  >>> browser.open('http://localhost/newapp/onlyjquery')
-  >>> print browser.contents
-  <html>
-    <head>
-      <script type="text/javascript" src="http://localhost/newapp/@@/jquery/jquery-1.3.2.js"></script>
-   </head>
-    <body>
-       <h1> HI GROK </h1>
-    </body>
-  </html>
-"""
-
-
-import grokcore.component as grok
-import grokcore.view as view
-
-from zope.interface import Interface
-from megrok.resource import Library, include, inclusion
-from hurry.resource import ResourceInclusion
-
-from zope.app.container import btree
-
-from zope.app.component.site import SiteManagerContainer
-from hurry.jquery import jquery
-
-
-class Application(SiteManagerContainer):
-    """ Sample Application """
-
-
-class BaseStyles(Library):
-    view.path('css')
-    grok.name('basestyles')
-
-    inclusion(name='JSBase', file='a.js')
-
-
-class NewStyles(Library):
-    view.path('css')
-    grok.name('newstyles')
-    
-    inclusion(name='JSMore', file='b.js', depends=[BaseStyles.get('JSBase'),])
-    inclusion(name='With_hurryjquery', file='b.js', depends=[jquery,])
-
-
-class Depends(view.View):
-    grok.context(Interface)
-    include(NewStyles, 'JSMore')
-    template = view.PageTemplateFile('templates/myview.pt')
-
-
-class WithJquery(view.View):
-    grok.context(Interface)
-    include(NewStyles, 'With_hurryjquery')
-    template = view.PageTemplateFile('templates/myview.pt')
-
-
-class OnlyJquery(view.View):
-    grok.context(Interface)
-    include(jquery)
-    template = view.PageTemplateFile('templates/myview.pt')
-
-
-###TestSetup
-def test_suite():
-    from zope.testing import doctest
-    from megrok.resource.ftests import FunctionalLayer
-    suite = doctest.DocTestSuite(
-        optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS
-        )
-    suite.layer = FunctionalLayer
-    return suite
-

Deleted: Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_hashedresource.py
===================================================================
--- Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_hashedresource.py	2009-11-19 16:31:33 UTC (rev 105881)
+++ Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_hashedresource.py	2009-11-19 16:32:32 UTC (rev 105882)
@@ -1,74 +0,0 @@
-"""
-megrok.resource
-===============
-
-
-Setup
------
-
-  >>> from zope.app.testing.functional import getRootFolder
-  >>> from zope.app.container import btree
-  >>> from zope.app.component.site import LocalSiteManager
-  >>> from zope.app.component.hooks import setSite
-
-  >>> root = getRootFolder()
-  >>> root['application'] = Application()
-
-
-Inclusion with z3c.hashedresource
----------------------------------
-
-First we get the hash for the HashedStyle Library to compare it
-with the inclusion we get in the page.
-
-   >>> from zope.component import getAdapter
-   >>> from zope.publisher.browser import TestRequest
-   >>> library = getAdapter(TestRequest(), name='hashedstyles')
-   >>> library
-   <grokcore.view.components.DirectoryResource object at ...>
-
-   >>> from z3c.hashedresource.interfaces import IResourceContentsHash
-   >>> hash = IResourceContentsHash(library)
-   
-
-Here we proof if we get the resource "a.js" in the context
-of a hashedresource.
-
-  >>> from zope.testbrowser.testing import Browser
-  >>> browser = Browser()
-  >>> ajs = 'http://localhost/++noop++%s/@@/hashedstyles/a.js' % hash
-  >>> browser.open(ajs)
-  >>> print browser.contents
-  /* Simple JS */
-"""
-
-import grokcore.component as grok
-import grokcore.view as view
-
-from zope.app.container import btree
-from zope.interface import Interface
-from hurry.resource import ResourceInclusion
-from zope.app.component.site import SiteManagerContainer
-from megrok.resource import Library, include, inclusion, hashed
-
-
-class Application(SiteManagerContainer):
-    """ Sample Application """
-
-class HashedStyles(Library):
-    view.path('css')
-    grok.name('hashedstyles')
-    hashed() 
-    inclusion(name='JS', file='a.js')
-
-
-###TestSetup
-def test_suite():
-    from zope.testing import doctest
-    from megrok.resource.ftests import FunctionalLayer
-    suite = doctest.DocTestSuite(
-        optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS
-        )
-    suite.layer = FunctionalLayer
-    return suite
-

Deleted: Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_inclusion.py
===================================================================
--- Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_inclusion.py	2009-11-19 16:31:33 UTC (rev 105881)
+++ Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_inclusion.py	2009-11-19 16:32:32 UTC (rev 105882)
@@ -1,143 +0,0 @@
-"""
-megrok.resource
-===============
-
-
-Setup
------
-
-  >>> from zope.app.testing.functional import getRootFolder
-  >>> from zope.app.container import btree
-  >>> from zope.app.component.site import LocalSiteManager
-  >>> from zope.app.component.hooks import setSite
-
-  >>> root = getRootFolder()
-  >>> root['app'] = Application()
-
-Our application has to be a Site to access the right url for the inclusions
-
-  >>> root['app'].setSiteManager(LocalSiteManager(root['app']))
-  >>> setSite(root['app'])
-  >>> root['app']
-  <megrok.resource.ftests.test_inclusion.Application object at ...>
-
-
-ResourceDirectory
------------------
-
-If we create a Library we should get an fully registerd ResourceDirectory.
-
-  >>> from zope.testbrowser.testing import Browser
-  >>> browser = Browser()
-  >>> browser.handleErrors = False 
-  >>> browser.open('http://localhost/@@/styles/a.js')
-  >>> print browser.contents
-  /* Simple JS */ 
-
-
-Inclusion
----------
-
-Now let's look if we can include the a.js File in a
-
-  >>> browser.open('http://localhost/app/simple')
-  >>> print browser.contents
-  <html>
-    <head>
-      <script type="text/javascript" src="http://localhost/app/@@/styles/a.js"></script>
-   </head>
-    <body>
-       <h1> HI GROK </h1>
-    </body>
-  </html>  
-
-
-AdvanceInclusion
-----------------
-
-  >>> browser.open('http://localhost/app/advanced')
-  >>> print browser.contents
-  <html>
-    <head>
-      <script type="text/javascript" src="http://localhost/app/@@/styles/a.js"></script>
-   </head>
-    <body>
-       <h1> HI GROK </h1>
-    <script type="text/javascript" src="http://localhost/app/@@/styles/b.js"></script></body>
-  </html>    
-
-
-Include All Inclusions
-----------------------
-
-  >>> browser.open('http://localhost/app/all')
-  >>> print browser.contents
-  <html>
-    <head>
-      <link rel="stylesheet" type="text/css" href="http://localhost/app/@@/styles/b.css" />
-  <script type="text/javascript" src="http://localhost/app/@@/styles/a.js"></script>
-  <script type="text/javascript" src="http://localhost/app/@@/styles/b.js"></script>
-   </head>
-    <body>
-       <h1> HI GROK </h1>
-    </body>
-  </html> 
-"""
-
-
-import grokcore.component as grok
-import grokcore.view as view
-
-from zope.interface import Interface
-from megrok.resource import Library, include, inclusion
-from hurry.resource import ResourceInclusion
-
-from zope.app.container import btree
-
-from zope.app.component.site import SiteManagerContainer
-
-#class Application(btree.BTreeContainer):
-class Application(SiteManagerContainer):
-    """ Sample Application """
-
-
-class Styles(Library):
-    view.path('css')
-    grok.name('styles')
-    
-    inclusion(name='JS', file='a.js')
-    inclusion(name='JSBottom', file='b.js', bottom=True)
-    inclusion(name='CSS', file='b.css', bottom=True)
-
-
-class Simple(view.View):
-    grok.context(Interface)
-    include(Styles, 'JS')
-    template = view.PageTemplateFile('templates/myview.pt')
-
-
-class Advanced(view.View):
-    grok.context(Interface)
-    include(Styles, 'JS')
-    include(Styles, 'JSBottom', bottom=True)
-    template = view.PageTemplateFile('templates/myview.pt')
-
-
-class All(view.View):
-    grok.context(Interface)
-    template = view.PageTemplateFile('templates/myview.pt')
-    include(Styles)
-
-
-
-
-###TestSetup
-def test_suite():
-    from zope.testing import doctest
-    from megrok.resource.ftests import FunctionalLayer
-    suite = doctest.DocTestSuite(
-        optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS
-        )
-    suite.layer = FunctionalLayer
-    return suite
-

Copied: Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_mf.py (from rev 105818, Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_inclusion.py)
===================================================================
--- Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_mf.py	                        (rev 0)
+++ Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_mf.py	2009-11-19 16:32:32 UTC (rev 105882)
@@ -0,0 +1,108 @@
+"""
+megrok.resource
+===============
+
+
+Setup
+-----
+
+  >>> from zope.app.testing.functional import getRootFolder
+  >>> from zope.app.container import btree
+  >>> from zope.app.component.site import LocalSiteManager
+  >>> from zope.app.component.hooks import setSite
+
+  >>> root = getRootFolder()
+  >>> root['simpleapp'] = Application()
+
+Our application has to be a Site to access the right url for the inclusions
+
+  >>> root['simpleapp'].setSiteManager(LocalSiteManager(root['simpleapp']))
+  >>> setSite(root['simpleapp'])
+  >>> root['simpleapp']
+  <megrok.resource.ftests.test_mf.Application object at ...>
+
+
+ResourceDirectory
+-----------------
+
+If we create a Library we should get an fully registerd ResourceDirectory.
+
+  >>> from zope.testbrowser.testing import Browser
+  >>> browser = Browser()
+  >>> browser.handleErrors = False 
+  >>> browser.open('http://localhost/@@/mylibrary/a.js')
+  >>> print browser.contents
+  /* Simple JS */ 
+
+For default we can access these resources with the help of z3c.hashedresource
+First we have to get the hash to look for the resource in the testbrowser.
+
+   >>> from zope.component import getAdapter
+   >>> from zope.publisher.browser import TestRequest
+   >>> library = getAdapter(TestRequest(), name='mylibrary')
+   >>> library
+   <grokcore.view.components.DirectoryResource object at ...>
+
+   >>> from z3c.hashedresource.interfaces import IResourceContentsHash
+   >>> hash = IResourceContentsHash(library)
+   
+   >>> ajs = 'http://localhost/++noop++%s/@@/mylibrary/a.js' % hash
+   >>> browser.open(ajs)
+   >>> print browser.contents
+   /* Simple JS */
+
+  >>> browser.open('http://localhost/simpleapp/simpleview')
+  >>> stag%(hash) in browser.contents 
+  True
+
+  >>> print browser.contents 
+  <html>
+    <head>
+   ...
+   </head>
+    <body>
+       <h1> HI GROK </h1>
+    </body>
+  </html>  
+
+
+"""
+
+stag = '<script type="text/javascript" src="http://localhost/simpleapp/++noop++%s/@@/mylibrary/a.js"></script>'
+
+import grokcore.component as grok
+import grokcore.view as view
+
+from megrok import resource
+from zope.interface import Interface
+from zope.app.component.site import SiteManagerContainer
+from hurry.resource import ResourceInclusion
+
+class Application(SiteManagerContainer):
+    """ Sample Application """
+
+
+class MyLibrary(resource.Library):
+    resource.path('css')
+    resource.name('mylibrary')
+    
+myjs = ResourceInclusion(MyLibrary, 'a.js')    
+
+class SimpleView(view.View):
+    grok.context(Interface)
+    resource.need(myjs)
+    resource.not_hashed()
+    template = view.PageTemplateFile('templates/myview.pt')
+
+
+
+###TestSetup
+def test_suite():
+    from zope.testing import doctest
+    from megrok.resource.ftests import FunctionalLayer
+    suite = doctest.DocTestSuite(
+        optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS
+        )
+    suite.layer = FunctionalLayer
+    return suite
+

Deleted: Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_readme.py
===================================================================
--- Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_readme.py	2009-11-19 16:31:33 UTC (rev 105881)
+++ Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/ftests/test_readme.py	2009-11-19 16:32:32 UTC (rev 105882)
@@ -1,21 +0,0 @@
-import unittest
-from zope.testing import doctest, module
-from zope.app.testing import functional
-from megrok.resource.ftests import FunctionalLayer
-
-def setUp(test):
-    module.setUp(test, 'megrok.resource.ftests')
-
-def tearDown(test):
-    module.tearDown(test)
-
-def test_suite():
-    readme = functional.FunctionalDocFileSuite(
-        '../README.txt', setUp=setUp, tearDown=tearDown,
-        optionflags=(doctest.ELLIPSIS + doctest.NORMALIZE_WHITESPACE),
-        )
-    readme.layer = FunctionalLayer
-    suite = unittest.TestSuite()
-    suite.addTest(readme)
-    return suite
-

Deleted: Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/utils.py
===================================================================
--- Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/utils.py	2009-11-19 16:31:33 UTC (rev 105881)
+++ Sandbox/cklinger/megrok.resource/trunk/src/megrok/resource/utils.py	2009-11-19 16:32:32 UTC (rev 105882)
@@ -1,27 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import grokcore.component as grok
-from zope import component
-from hurry.resource.interfaces import ILibraryUrl
-from zope.app.component.hooks import getSite
-from zope.traversing.browser.interfaces import IAbsoluteURL
-from hurry.zoperesource.zopesupport import getRequest
-from z3c.hashedresource.interfaces import IResourceContentsHash
-from megrok.resource import Library, hashed
-from zope.interface import Interface
-
-
- at grok.adapter(Interface)
- at grok.implementer(ILibraryUrl)
-def library_url(library):
-    request = getRequest()
-    is_hashed = hashed.bind().get(library)
-    url = str(component.getMultiAdapter((getSite(), request),
-                                         IAbsoluteURL)) + '/@@/' + library.name
-    if is_hashed:
-        resource = component.getAdapter(request, name=library.name)
-        hash = IResourceContentsHash(resource)
-        base_url = component.getMultiAdapter((getSite(), request), IAbsoluteURL)
-        url = '%s/++noop++%s/@@/%s' % (url, hash, library.name)
-
-    return url



More information about the checkins mailing list