[Checkins] SVN: zc.extjsresource/branches/dev/ Moving to zope.org repository.

Jim Fulton jim at zope.com
Tue Mar 25 17:46:34 EDT 2008


Log message for revision 84947:
  Moving to zope.org repository.
  

Changed:
  U   zc.extjsresource/branches/dev/README.txt
  U   zc.extjsresource/branches/dev/buildout.cfg
  U   zc.extjsresource/branches/dev/setup.py
  A   zc.extjsresource/branches/dev/src/zc/extjsresource/
  A   zc.extjsresource/branches/dev/src/zc/extjsresource/__init__.py
  A   zc.extjsresource/branches/dev/src/zc/extjsresource/configure.zcml
  A   zc.extjsresource/branches/dev/src/zc/extjsresource/tests.py

-=-
Modified: zc.extjsresource/branches/dev/README.txt
===================================================================
--- zc.extjsresource/branches/dev/README.txt	2008-03-25 21:29:45 UTC (rev 84946)
+++ zc.extjsresource/branches/dev/README.txt	2008-03-25 21:46:34 UTC (rev 84947)
@@ -1,11 +1,36 @@
-***********************
-Title Here
-***********************
+********************************************
+Zope Packaging of the Ext Javascript library
+********************************************
 
-Changes
-*******
+This distribution provides a packaging of the Ext Javascript library,
+http://extjs.com/ as a Python package.  It provides both a Zope 3
+resource directory named "extjs" and a zc.resourcelibrary resource
+library named "Ext".  
 
-0.1 (yyyy-mm-dd)
-================
+This distribution can be used with non-Zope applications, by simply
+loading the Ext Javascript and CSS files as package data from the
+extjs subdirectory of the zc.extjsresource Python package.
 
-Initial release
+When this distribution is installed, the Ext distribution is
+downloaded and included in the installed Python package. (This means
+that network access is required to install this package from source.)
+
+To use in Zope 3, include the zc.extjsresource package in your ZCML
+and use one of the following resource libraries:
+
+Ext
+   To use Ext alone with it's own internal base library
+
+Ext-YUI
+   To use Ext built on the Yahoo User Interface library
+
+Ext-jQuery
+   To use Ext built on the jQuery library.
+
+Ext-Prototype
+   To use Ext built on the Prototype and Scriptaculous libraries.
+
+In Zope 3, if development mode is enabled ("devmode on" in zope.conf),
+then unpacked versions of the Ext libraries are used.  These are
+larger but make debugging much easoer.
+

Modified: zc.extjsresource/branches/dev/buildout.cfg
===================================================================
--- zc.extjsresource/branches/dev/buildout.cfg	2008-03-25 21:29:45 UTC (rev 84946)
+++ zc.extjsresource/branches/dev/buildout.cfg	2008-03-25 21:46:34 UTC (rev 84947)
@@ -1,12 +1,8 @@
 [buildout]
+parts = test
 develop = .
-parts = test py
 
 [test]
 recipe = zc.recipe.testrunner
-eggs = 
+eggs = zc.extjsresource
 
-[py]
-recipe = zc.recipe.egg
-eggs = ${test:eggs}
-interpreter = py

Modified: zc.extjsresource/branches/dev/setup.py
===================================================================
--- zc.extjsresource/branches/dev/setup.py	2008-03-25 21:29:45 UTC (rev 84946)
+++ zc.extjsresource/branches/dev/setup.py	2008-03-25 21:46:34 UTC (rev 84947)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Corporation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -11,38 +11,59 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-import os
-from setuptools import setup, find_packages
+import os, setuptools, shutil, urllib2, zipfile
 
-entry_points = """
-"""
+rname = 'ext-2.0.2'
+url_base = 'http://extjs.com/deploy'
+version = '2.0.2-1dev'
 
-def read(rname):
-    return open(os.path.join(os.path.dirname(__file__), *rname.split('/')
-                             )).read()
+dest = os.path.join(os.path.dirname(__file__),
+                    'src', 'zc', 'extjsresource', 'extjs')
+extpaths = []
+if not os.path.exists(dest):
+    zip_name = rname + '.zip'
+    if not os.path.exists(zip_name):
+        x = urllib2.urlopen(url_base+'/'+zip_name).read()
+        open(zip_name, 'w').write(x)
 
-long_description = (
-        read('src/zc/?/README.txt')
-        + '\n' +
-        'Download\n'
-        '--------\n'
-        )
+    zfile = zipfile.ZipFile(zip_name, 'r')
 
-open('doc.txt', 'w').write(long_description)
+    prefix = rname + '/'
+    lprefix = len(rname)
 
-setup(
-    name = '',
-    version = '0.1',
-    author = 'Jim Fulton',
-    author_email = 'jim at zope.com',
-    description = '',
-    long_description=long_description,
-    license = 'ZPL 2.1',
-    
-    packages = find_packages('src'),
+    for zname in sorted(zfile.namelist()):
+        assert zname.startswith(prefix)
+        dname = dest + zname[lprefix:]
+        if dname[-1:] == '/':
+            os.makedirs(dname)
+        else:
+            open(dname, 'w').write(zfile.read(zname))
+            extpaths.append('extjs/'+zname[lprefix:])
+else:
+    lbase = len(os.path.dirname(dest))+1
+    for path, dirs, files in os.walk(dest):
+        prefix = path[lbase:]
+        for file in files:
+            extpaths.append(os.path.join(prefix, file))
+
+def read(*rnames):
+    return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+setuptools.setup(
+    name = 'zc.extjsresource',
+    version = version,
+    description = "Zope Packaging of the Ext Javascript library",
+    long_description = read('README.txt'),
+
+    packages = ['zc', 'zc.extjsresource'],
+    package_dir = {'':'src'},
+    include_package_data = True,
+    package_data = {'zc.extjsresource': extpaths},
     namespace_packages = ['zc'],
-    package_dir = {'': 'src'},
-    install_requires = 'setuptools',
-    zip_safe = False,
-    entry_points=entry_points,
+    install_requires = [
+        'setuptools',
+        'zc.resourcelibrary',
+        'zc.extjsresource',
+        ],
+    zip_safe=False,
     )

Added: zc.extjsresource/branches/dev/src/zc/extjsresource/__init__.py
===================================================================
--- zc.extjsresource/branches/dev/src/zc/extjsresource/__init__.py	                        (rev 0)
+++ zc.extjsresource/branches/dev/src/zc/extjsresource/__init__.py	2008-03-25 21:46:34 UTC (rev 84947)
@@ -0,0 +1,48 @@
+##############################################################################
+#
+# Copyright (c) Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import zope.component
+import zope.interface
+import zope.app.publisher.browser.directoryresource
+
+class DirectoryResource(
+    zope.app.publisher.browser.directoryresource.DirectoryResource):
+
+    def publishTraverse(self, request, name):
+        if name == 'set_blank_image.js':
+            return self.set_blank_image_js
+        return self.get(name)
+
+    def set_blank_image_js(self):
+        extjs = zope.component.getAdapter(
+            self.request, zope.interface.Interface, 'extjs')
+        return (
+            "Ext.BLANK_IMAGE_URL = '%s/resources/images/default/s.gif';\n"
+            % extjs()
+            )
+
+class DirectoryResourceFactory(
+    zope.app.publisher.browser.directoryresource.DirectoryResourceFactory):
+
+    def __init__(self, path, checker, name):
+        self.__dir = zope.app.publisher.browser.directoryresource.Directory(
+            path, checker, name)
+        self.__checker = checker
+        self.__name = name
+    
+    def __call__(self, request):
+        resource = DirectoryResource(self.__dir, request)
+        resource.__Security_checker__ = self.__checker
+        resource.__name__ = self.__name
+        return resource


Property changes on: zc.extjsresource/branches/dev/src/zc/extjsresource/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: zc.extjsresource/branches/dev/src/zc/extjsresource/configure.zcml
===================================================================
--- zc.extjsresource/branches/dev/src/zc/extjsresource/configure.zcml	                        (rev 0)
+++ zc.extjsresource/branches/dev/src/zc/extjsresource/configure.zcml	2008-03-25 21:46:34 UTC (rev 84947)
@@ -0,0 +1,77 @@
+<configure
+   xmlns="http://namespaces.zope.org/zope"
+   xmlns:browser="http://namespaces.zope.org/browser"
+   xmlns:zcml="http://namespaces.zope.org/zcml"
+   >
+  <browser:resourceDirectory name="extjs" directory="extjs" />
+
+  <include package="zc.resourcelibrary" file="meta.zcml"/>
+  <include package="zc.resourcelibrary" />
+
+  <resourceLibrary name="Ext-yui-adapter">
+    <directory
+       source="extjs"
+       include="adapter/yui/yui-utilities.js
+                adapter/yui/ext-yui-adapter.js
+                "
+       />
+  </resourceLibrary>
+
+  <resourceLibrary name="Ext-jquery-adapter">
+    <directory
+       source="extjs"
+       include="adapter/jquery/jquery.js
+                adapter/jquery/ext-jquery-adapter.js
+                "
+       />
+  </resourceLibrary>
+
+  <resourceLibrary name="Ext-prototype-adapter">
+    <directory
+       source="extjs"
+       include="adapter/prototype/effects.js
+                adapter/prototype/prototype.js
+                adapter/prototype/scriptaculous.js
+                adapter/prototype/ext-prototype-adapter.js
+                "
+       />
+  </resourceLibrary>
+
+  <resourceLibrary name="Ext-ext-adapter">
+    <directory
+       source="extjs"
+       include="adapter/ext/ext-base.js"
+       />
+  </resourceLibrary>
+
+  <resourceLibrary name="Ext-support">
+    <directory
+       source="extjs"
+       include="set_blank_image.js
+                resources/css/ext-all.css
+                "
+       factory = ".DirectoryResourceFactory"
+       />
+  </resourceLibrary>
+
+  <resourceLibrary name="Ext-library" require="Ext-support">
+    <directory
+       zcml:condition="have devmode"
+       source="extjs"
+       include="ext-all-debug.js"
+       />
+    <directory
+       zcml:condition="not-have devmode"
+       source="extjs"
+       include="ext-all.js"
+       />
+  </resourceLibrary>
+
+  <resourceLibrary name="Ext" require="Ext-ext-adapter Ext-library" />
+  <resourceLibrary name="Ext-ext" require="Ext-ext-adapter Ext-library" />
+  <resourceLibrary name="Ext-yui" require="Ext-yui-adapter Ext-library" />
+  <resourceLibrary name="Ext-jquery" require="Ext-jquery-adapter Ext-library" />
+  <resourceLibrary name="Ext-prototype"
+                   require="Ext-prototype-adapter Ext-library" />
+
+</configure>


Property changes on: zc.extjsresource/branches/dev/src/zc/extjsresource/configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zc.extjsresource/branches/dev/src/zc/extjsresource/tests.py
===================================================================
--- zc.extjsresource/branches/dev/src/zc/extjsresource/tests.py	                        (rev 0)
+++ zc.extjsresource/branches/dev/src/zc/extjsresource/tests.py	2008-03-25 21:46:34 UTC (rev 84947)
@@ -0,0 +1,65 @@
+##############################################################################
+#
+# Copyright (c) Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+import os, unittest
+from zope.testing import doctest
+
+import zope.component
+import zope.interface
+
+from zope.app.publisher.browser.tests import test_directoryresource
+DirectoryResourceFactory_orig = test_directoryresource.DirectoryResourceFactory
+
+import zc.extjsresource
+
+class FauxExtjsResource:
+
+    def __init__(self, request):
+        pass
+
+    def __call__(self):
+        return 'http://localhost/@@/extjs'
+
+class Test(test_directoryresource.Test):
+
+    def setUp(self):
+        test_directoryresource.Test.setUp(self)
+        test_directoryresource.DirectoryResourceFactory = (
+            zc.extjsresource.DirectoryResourceFactory)
+
+    def tearDown(self):
+        test_directoryresource.DirectoryResourceFactory = (
+            DirectoryResourceFactory_orig)
+        test_directoryresource.Test.tearDown(self)
+
+    def test_set_blank_image_js(self):
+        path = os.path.join(test_directoryresource.test_directory, 'testfiles')
+        request = test_directoryresource.TestRequest()
+        factory = zc.extjsresource.DirectoryResourceFactory(
+            path, test_directoryresource.checker, 'testfiles')
+        resource = factory(request)
+
+        zope.component.provideAdapter(
+            FauxExtjsResource,
+            [test_directoryresource.TestRequest],
+            zope.interface.Interface, 'extjs',
+            )
+
+        self.assertEqual(
+            resource.publishTraverse(request, 'set_blank_image.js')(),
+            "Ext.BLANK_IMAGE_URL = "
+            "'http://localhost/@@/extjs/resources/images/default/s.gif';\n"
+            )
+
+def test_suite():
+    return unittest.makeSuite(Test)


Property changes on: zc.extjsresource/branches/dev/src/zc/extjsresource/tests.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native



More information about the Checkins mailing list