[Checkins] SVN: zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/
Tag 0.5.2
Brian Sutherland
cvs-admin at zope.org
Wed Jun 14 20:24:42 EDT 2006
Log message for revision 68640:
Tag 0.5.2
Changed:
A zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/
A zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/Makefile
A zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/ZopePublicLicense.txt
D zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/setup.py
A zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/setup.py
D zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/src/zc/resourcelibrary/resourcelibrary.py
A zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/src/zc/resourcelibrary/resourcelibrary.py
D zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/src/zc/resourcelibrary/zcml.py
A zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/src/zc/resourcelibrary/zcml.py
-=-
Copied: zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2 (from rev 68625, zc.resourcelibrary/trunk)
Copied: zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/Makefile (from rev 68639, zc.resourcelibrary/trunk/Makefile)
Copied: zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/ZopePublicLicense.txt (from rev 68639, zc.resourcelibrary/trunk/ZopePublicLicense.txt)
Deleted: zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/setup.py
===================================================================
--- zc.resourcelibrary/trunk/setup.py 2006-06-13 22:00:47 UTC (rev 68625)
+++ zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/setup.py 2006-06-15 00:24:37 UTC (rev 68640)
@@ -1,25 +0,0 @@
-from setuptools import setup, find_packages
-
-setup(
- name="zc.resourcelibrary",
- version="0.5.1",
- packages=find_packages('src', exclude=["*.tests", "*.ftests"]),
-
- package_dir= {'':'src'},
-
- namespace_packages=['zc'],
- package_data = {
- '': ['*.txt', '*.zcml'],
- },
-
- zip_safe=False,
- author='Zope Project',
- author_email='zope3-dev at zope.org',
- description="""\
-The resource library is a Zope 3 extension that is designed to make the
-inclusion of JavaScript, CSS, and other resources easy, cache-friendly,
-and component-friendly.
-""",
- license='ZPL',
- keywords="zope zope3",
- )
Copied: zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/setup.py (from rev 68639, zc.resourcelibrary/trunk/setup.py)
Deleted: zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/src/zc/resourcelibrary/resourcelibrary.py
===================================================================
--- zc.resourcelibrary/trunk/src/zc/resourcelibrary/resourcelibrary.py 2006-06-13 22:00:47 UTC (rev 68625)
+++ zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/src/zc/resourcelibrary/resourcelibrary.py 2006-06-15 00:24:37 UTC (rev 68640)
@@ -1,35 +0,0 @@
-from zope.publisher.interfaces import IRequest
-import zope.security.management
-import zope.security.interfaces
-
-library_info = {}
-
-class LibraryInfo(object):
- def __init__(self):
- self.included = []
- self.required = []
-
-
-def getRequest():
- try:
- i = zope.security.management.getInteraction() # raises NoInteraction
- except zope.security.interfaces.NoInteraction:
- return
-
- for p in i.participations:
- if IRequest.providedBy(p):
- return p
-
-def need(library_name):
- request = getRequest()
- # only take note of needed libraries if there is a request, and it is
- # capable of handling resource librarys
- if request and hasattr(request, 'resource_libraries'):
- if not library_name in request.resource_libraries:
- request.resource_libraries.append(library_name)
-
-def getRequired(name):
- return library_info[name].required
-
-def getIncluded(name):
- return library_info[name].included
Copied: zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/src/zc/resourcelibrary/resourcelibrary.py (from rev 68639, zc.resourcelibrary/trunk/src/zc/resourcelibrary/resourcelibrary.py)
Deleted: zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/src/zc/resourcelibrary/zcml.py
===================================================================
--- zc.resourcelibrary/trunk/src/zc/resourcelibrary/zcml.py 2006-06-13 22:00:47 UTC (rev 68625)
+++ zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/src/zc/resourcelibrary/zcml.py 2006-06-15 00:24:37 UTC (rev 68640)
@@ -1,106 +0,0 @@
-from zc.resourcelibrary.resourcelibrary import LibraryInfo, library_info
-from zope.app import zapi
-from zope.app.publisher.browser import directoryresource
-from zope.app.publisher.browser.metadirectives import IBasicResourceInformation
-from zope.app.publisher.browser.resourcemeta import allowed_names
-from zope.configuration.exceptions import ConfigurationError
-from zope.interface import Interface
-from zope.publisher.interfaces.browser import IBrowserRequest
-from zope.publisher.interfaces.browser import IDefaultBrowserLayer
-from zope.security.checker import CheckerPublic, NamesChecker
-import os.path
-import zope.configuration.fields
-
-class IResourceLibraryDirective(IBasicResourceInformation):
- """
- Defines a resource library
- """
-
- name = zope.schema.TextLine(
- title=u"The name of the resource library",
- description=u"""\
- This is the name used to disambiguate resource libraries. No two
- libraries can be active with the same name.""",
- required=True,
- )
-
- require = zope.configuration.fields.Tokens(
- title=u"Require",
- description=u"The resource libraries on which this library depends.",
- required=False,
- value_type=zope.schema.Text(),
- )
-
-
-class IDirectoryDirective(Interface):
- """
- Identifies a directory to be included in a resource library
- """
-
- source = zope.configuration.fields.Path(
- title=u"Source",
- description=u"The directory containing the files to add.",
- required=True,
- )
-
- include = zope.configuration.fields.Tokens(
- title=u"Include",
- description=u"The files which should be included in HTML pages which "
- u"reference this resource library.",
- required=False,
- value_type=zope.schema.Text(),
- )
-
-
-def handler(name, dependencies, required, provided, adapter_name, factory, info=''):
- if dependencies:
- for dep in dependencies:
- if dep not in library_info:
- raise ConfigurationError(
- 'Resource library "%s" has unsatisfied dependency on "%s".'
- % (name, dep))
- zapi.getGlobalSiteManager().registerAdapter(
- factory, required, provided, adapter_name, info)
-
-
-INCLUDABLE_EXTENTIONS = ('.js', '.css')
-
-class ResourceLibrary(object):
-
- def __init__(self, _context, name, require=(),
- layer=IDefaultBrowserLayer, permission='zope.Public'):
- self.name = name
- self.layer = layer
-
- if permission == 'zope.Public':
- permission = CheckerPublic
- self.checker = NamesChecker(allowed_names, permission)
-
- # make note of the library in a global registry
- library_info[name] = LibraryInfo()
- library_info[name].required.extend(require)
-
- def directory(self, _context, source, include=()):
- if not os.path.isdir(source):
- raise ConfigurationError("Directory %r does not exist" % source)
-
- for file_name in include:
- ext = os.path.splitext(file_name)[1]
- if ext not in INCLUDABLE_EXTENTIONS:
- raise ConfigurationError(
- 'Resource library doesn\'t know how to include this '
- 'file: "%s".' % file_name)
-
- # remember which files should be included in the HTML when this library
- # is referenced
- library_info[self.name].included.extend(include)
-
- factory = directoryresource.DirectoryResourceFactory(
- source, self.checker, self.name)
-
- _context.action(
- discriminator = ('resource', self.name, IBrowserRequest, self.layer),
- callable = handler,
- args = (self.name, library_info[self.name].required, (self.layer,),
- Interface, self.name, factory, _context.info),
- )
Copied: zc.resourcelibrary/tags/zc.resourcelibrary-0.5.2/src/zc/resourcelibrary/zcml.py (from rev 68639, zc.resourcelibrary/trunk/src/zc/resourcelibrary/zcml.py)
More information about the Checkins
mailing list