[Checkins] SVN: hurry.js.wforms/ Initial import, not yet finished.
Martijn Faassen
faassen at infrae.com
Sun Dec 14 09:35:00 EST 2008
Log message for revision 94056:
Initial import, not yet finished.
Changed:
A hurry.js.wforms/
A hurry.js.wforms/trunk/
A hurry.js.wforms/trunk/CHANGES.txt
A hurry.js.wforms/trunk/MANIFEST.in
A hurry.js.wforms/trunk/README.txt
A hurry.js.wforms/trunk/buildout.cfg
A hurry.js.wforms/trunk/setup.py
A hurry.js.wforms/trunk/src/
A hurry.js.wforms/trunk/src/hurry/
A hurry.js.wforms/trunk/src/hurry/__init__.py
A hurry.js.wforms/trunk/src/hurry/js/
A hurry.js.wforms/trunk/src/hurry/js/__init__.py
A hurry.js.wforms/trunk/src/hurry/js/wforms/
A hurry.js.wforms/trunk/src/hurry/js/wforms/__init__.py
A hurry.js.wforms/trunk/src/hurry/js/wforms/download.py
A hurry.js.wforms/trunk/src/hurry/js/wforms/prepare.py
A hurry.js.wforms/trunk/src/hurry/js/wforms/wforms.py
-=-
Added: hurry.js.wforms/trunk/CHANGES.txt
===================================================================
--- hurry.js.wforms/trunk/CHANGES.txt (rev 0)
+++ hurry.js.wforms/trunk/CHANGES.txt 2008-12-14 14:35:00 UTC (rev 94056)
@@ -0,0 +1,7 @@
+CHANGES
+*******
+
+3.0 (unreleased) (wforms version: 3.0)
+======================================
+
+* Initial public release.
Added: hurry.js.wforms/trunk/MANIFEST.in
===================================================================
--- hurry.js.wforms/trunk/MANIFEST.in (rev 0)
+++ hurry.js.wforms/trunk/MANIFEST.in 2008-12-14 14:35:00 UTC (rev 94056)
@@ -0,0 +1 @@
+recursive-include src/hurry/js/wforms/resources *
Added: hurry.js.wforms/trunk/README.txt
===================================================================
--- hurry.js.wforms/trunk/README.txt (rev 0)
+++ hurry.js.wforms/trunk/README.txt 2008-12-14 14:35:00 UTC (rev 94056)
@@ -0,0 +1,54 @@
+hurry.js.wforms
+***************
+
+Introduction
+============
+
+This library packages wforms_ for `hurry.resource`_.
+
+.. _`hurry.resource`: http://pypi.python.org/pypi/hurry.resource
+
+.. _wforms: http://www.formassembly.com/wForms/
+
+How to use?
+===========
+
+You can import ``wforms`` like this::
+
+ from hurry.js.wforms import wforms
+
+And then to trigger inclusion in the web page, anywhere within
+your page or widget rendering code, do this::
+
+ wforms.need()
+
+This requires integration between your web framework and
+``hurry.resource``, and making sure that the original resources
+(shipped in the ``resources`` directory in ``hurry.js.wforms``) are
+published to some URL.
+
+The package has already been integrated for Grok_ and Zope 3. If you
+depend on the `hurry.zoperesource`_ package along with
+``hurry.js.wforms`` in your ``setup.py``, the above example should work
+out of the box.
+
+.. _`hurry.zoperesource`: http://pypi.python.org/pypi/hurry.zoperesource
+
+.. _Grok: http://grok.zope.org
+
+Preparing hurry.js.wforms before release
+========================================
+
+This section is only relevant to release managers of ``hurry.js.wforms``; if
+you don't know whether you are, you aren't.
+
+When releasing ``hurry.js.wforms``, an extra step should be
+taken. Follow the regular package `release instructions`_, but before
+egg generation (``python setup.py register sdist upload``) first
+execute ``bin/wformsprepare <version number>`` (you may have to run
+``buildout`` first to install the prepare command), where version
+number is the version of the wforms release, such as ``1.0``. This will
+download the code of that version and place it in the egg. After that
+you can upload it.
+
+.. _`release instructions`: http://grok.zope.org/documentation/how-to/releasing-software
Added: hurry.js.wforms/trunk/buildout.cfg
===================================================================
--- hurry.js.wforms/trunk/buildout.cfg (rev 0)
+++ hurry.js.wforms/trunk/buildout.cfg 2008-12-14 14:35:00 UTC (rev 94056)
@@ -0,0 +1,20 @@
+[buildout]
+develop = .
+parts = scripts devpython test
+versions = versions
+
+[versions]
+
+[scripts]
+recipe = zc.recipe.egg:scripts
+eggs = hurry.tinymce
+
+[devpython]
+recipe = zc.recipe.egg
+interpreter = devpython
+eggs = hurry.tinymce
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = hurry.tinymce
+defaults = ['--tests-pattern', '^f?tests$', '-v']
Added: hurry.js.wforms/trunk/setup.py
===================================================================
--- hurry.js.wforms/trunk/setup.py (rev 0)
+++ hurry.js.wforms/trunk/setup.py 2008-12-14 14:35:00 UTC (rev 94056)
@@ -0,0 +1,44 @@
+from setuptools import setup, find_packages
+
+WFORMS_VERSION = '3.0'
+
+import sys, os
+
+def read(*rnames):
+ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+long_description = (
+ read('README.txt')
+ + '\n' +
+ read('CHANGES.txt')
+ + '\n' +
+ 'Download\n'
+ '********\n'
+ )
+
+setup(
+ name='hurry.js.wforms2',
+ version=WFORMS_VERSION + 'dev',
+ description="wforms for hurry.resource.",
+ long_description=long_description,
+ classifiers=[],
+ keywords='',
+ author='Martijn Faassen',
+ author_email='faassen at startifact.com',
+ license='LGPL', # ZPL 2.1 for python code, LPGL for JS bundled
+ packages=find_packages('src'),
+ package_dir={'': 'src'},
+ namespace_packages=['hurry', 'hurry.js'],
+ include_package_data=True,
+ zip_safe=False,
+ install_requires=[
+ 'setuptools',
+ 'hurry.resource',
+ ],
+ entry_points= {
+ 'console_scripts': [
+ 'wformsprepare = hurry.js.wforms.prepare:main',
+ ]
+ },
+
+ )
Added: hurry.js.wforms/trunk/src/hurry/__init__.py
===================================================================
--- hurry.js.wforms/trunk/src/hurry/__init__.py (rev 0)
+++ hurry.js.wforms/trunk/src/hurry/__init__.py 2008-12-14 14:35:00 UTC (rev 94056)
@@ -0,0 +1,7 @@
+# this is a namespace package
+try:
+ import pkg_resources
+ pkg_resources.declare_namespace(__name__)
+except ImportError:
+ import pkgutil
+ __path__ = pkgutil.extend_path(__path__, __name__)
Added: hurry.js.wforms/trunk/src/hurry/js/__init__.py
===================================================================
--- hurry.js.wforms/trunk/src/hurry/js/__init__.py (rev 0)
+++ hurry.js.wforms/trunk/src/hurry/js/__init__.py 2008-12-14 14:35:00 UTC (rev 94056)
@@ -0,0 +1,7 @@
+# this is a namespace package
+try:
+ import pkg_resources
+ pkg_resources.declare_namespace(__name__)
+except ImportError:
+ import pkgutil
+ __path__ = pkgutil.extend_path(__path__, __name__)
Added: hurry.js.wforms/trunk/src/hurry/js/wforms/__init__.py
===================================================================
--- hurry.js.wforms/trunk/src/hurry/js/wforms/__init__.py (rev 0)
+++ hurry.js.wforms/trunk/src/hurry/js/wforms/__init__.py 2008-12-14 14:35:00 UTC (rev 94056)
@@ -0,0 +1 @@
+from hurry.base2.base2 import *
Added: hurry.js.wforms/trunk/src/hurry/js/wforms/download.py
===================================================================
--- hurry.js.wforms/trunk/src/hurry/js/wforms/download.py (rev 0)
+++ hurry.js.wforms/trunk/src/hurry/js/wforms/download.py 2008-12-14 14:35:00 UTC (rev 94056)
@@ -0,0 +1,45 @@
+import urllib2
+import tempfile, shutil
+import os
+
+SF_URL_TEMPLATE = 'http://sourceforge.net/project/downloading.php?groupname=tinymce&filename=tinymce_%s.zip'
+
+def download(version, callback):
+ """Download a tinymce of version.
+
+ When downloaded, call callback with path to directory
+ with an extracted tinymce. The callback will then be able to copy
+ this to the appropriate location.
+ """
+ url = SF_URL_TEMPLATE % version.replace('.', '_')
+ f = urllib2.urlopen(url)
+ data = f.read()
+ f.close()
+
+ download_url = find_a_href(data, 'direct link')
+
+ f = urllib2.urlopen(download_url)
+ file_data = f.read()
+ f.close()
+
+ dirpath = tempfile.mkdtemp()
+ try:
+ tinymce_path = os.path.join(dirpath, 'tinymce.zip')
+ ex_path = os.path.join(dirpath, 'tinymce_ex')
+ g = open(tinymce_path, 'wb')
+ g.write(file_data)
+ g.close()
+ os.system('unzip -qq "%s" -d "%s"' % (tinymce_path, ex_path))
+ callback(ex_path)
+ finally:
+ shutil.rmtree(dirpath, ignore_errors=True)
+
+def find_a_href(data, content):
+ """Given start of content of the <a href="">content</a> find href.
+ """
+ i = data.find(content)
+ a = '<a href="'
+ href_start = data.rfind(a, 0, i)
+ href_start += len(a)
+ href_end = data.find('"', href_start)
+ return data[href_start:href_end]
Added: hurry.js.wforms/trunk/src/hurry/js/wforms/prepare.py
===================================================================
--- hurry.js.wforms/trunk/src/hurry/js/wforms/prepare.py (rev 0)
+++ hurry.js.wforms/trunk/src/hurry/js/wforms/prepare.py 2008-12-14 14:35:00 UTC (rev 94056)
@@ -0,0 +1,25 @@
+import os, sys
+import shutil
+
+from hurry.wforms.download import download
+
+def main():
+ try:
+ version = sys.argv[1]
+ except IndexError:
+ print "Usage: wformsprepare <wforms version>"
+ return
+
+ # download library into package
+ package_dir = os.path.dirname(__file__)
+ dest_path = os.path.join(package_dir, 'resources')
+
+ # remove previous library
+ shutil.rmtree(dest_path, ignore_errors=True)
+
+ def copy(ex_path):
+ """Copy to location 'resources' in package."""
+ build_path = os.path.join(ex_path, 'tinymce', 'jscripts', 'tiny_mce')
+ shutil.copytree(build_path, dest_path)
+
+ download(version, copy)
Added: hurry.js.wforms/trunk/src/hurry/js/wforms/wforms.py
===================================================================
--- hurry.js.wforms/trunk/src/hurry/js/wforms/wforms.py (rev 0)
+++ hurry.js.wforms/trunk/src/hurry/js/wforms/wforms.py 2008-12-14 14:35:00 UTC (rev 94056)
@@ -0,0 +1,12 @@
+from hurry.resource import Library, ResourceInclusion
+
+base2_lib = Library('base2')
+
+dom = ResourceInclusion(base2_lib,
+ 'src/base2-dom-strict.js',
+ minified='base2-dom-p.js')
+
+
+tinymce = ResourceInclusion(tinymce_lib, 'tiny_mce_src.js',
+ minified='tiny_mce.js')
+
More information about the Checkins
mailing list