[Checkins] SVN: Initial Release of IBAN widget

Hermann Himmelbauer dusty at qwer.tk
Tue Nov 4 12:11:50 EST 2008


Log message for revision 92775:
  Initial Release of IBAN widget
  

Changed:
  A   branches/
  A   tags/
  A   trunk/
  A   trunk/AUTHOR.txt
  A   trunk/CHANGES.txt
  A   trunk/LICENSE.txt
  A   trunk/README.txt
  A   trunk/TODOS.txt
  A   trunk/bootstrap.py
  A   trunk/buildout.cfg
  A   trunk/setup.py
  A   trunk/src/
  A   trunk/src/z3c/
  A   trunk/src/z3c/__init__.py
  A   trunk/src/z3c/iban/
  A   trunk/src/z3c/iban/README.txt
  A   trunk/src/z3c/iban/SETUP.cfg
  A   trunk/src/z3c/iban/__init__.py
  A   trunk/src/z3c/iban/configure.zcml
  A   trunk/src/z3c/iban/field.py
  A   trunk/src/z3c/iban/i18n.py
  A   trunk/src/z3c/iban/interfaces.py
  A   trunk/src/z3c/iban/tests.py
  A   trunk/src/z3c/iban/z3c.iban-configure.zcml

-=-
Added: trunk/AUTHOR.txt
===================================================================
--- trunk/AUTHOR.txt	                        (rev 0)
+++ trunk/AUTHOR.txt	2008-11-04 17:11:48 UTC (rev 92775)
@@ -0,0 +1,4 @@
+Hermann Himmelbauer (dusty |at| qwer.tk)
+
+Thanks goes to ACT, the Austrian Center of Training Firms for supporting
+this work.

Added: trunk/CHANGES.txt
===================================================================
--- trunk/CHANGES.txt	                        (rev 0)
+++ trunk/CHANGES.txt	2008-11-04 17:11:48 UTC (rev 92775)
@@ -0,0 +1,10 @@
+=======
+CHANGES
+=======
+
+Version 0.1.0 (04/11/2008)
+-------------------------
+
+- Initial Release
+
+  * Implementation of ``IBAN`` field.

Added: trunk/LICENSE.txt
===================================================================
--- trunk/LICENSE.txt	                        (rev 0)
+++ trunk/LICENSE.txt	2008-11-04 17:11:48 UTC (rev 92775)
@@ -0,0 +1,54 @@
+Zope Public License (ZPL) Version 2.1
+-------------------------------------
+
+A copyright notice accompanies this license document that
+identifies the copyright holders.
+
+This license has been certified as open source. It has also
+been designated as GPL compatible by the Free Software
+Foundation (FSF).
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions in source code must retain the
+   accompanying copyright notice, this list of conditions,
+   and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the accompanying
+   copyright notice, this list of conditions, and the
+   following disclaimer in the documentation and/or other
+   materials provided with the distribution.
+
+3. Names of the copyright holders must not be used to
+   endorse or promote products derived from this software
+   without prior written permission from the copyright
+   holders.
+
+4. The right to distribute this software or to use it for
+   any purpose does not give you the right to use
+   Servicemarks (sm) or Trademarks (tm) of the copyright
+   holders. Use of them is covered by separate agreement
+   with the copyright holders.
+
+5. If any files are modified, you must cause the modified
+   files to carry prominent notices stating that you changed
+   the files and the date of any change.
+
+Disclaimer
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
+  AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+  NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+  AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
+  NO EVENT SHALL THE COPYRIGHT HOLDERS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+  DAMAGE.

Added: trunk/README.txt
===================================================================
--- trunk/README.txt	                        (rev 0)
+++ trunk/README.txt	2008-11-04 17:11:48 UTC (rev 92775)
@@ -0,0 +1,2 @@
+A package implementing an IBAN field for ``zope.schema`` and support for
+using the field with ``z3c.form``.

Added: trunk/TODOS.txt
===================================================================
--- trunk/TODOS.txt	                        (rev 0)
+++ trunk/TODOS.txt	2008-11-04 17:11:48 UTC (rev 92775)
@@ -0,0 +1,3 @@
+=====
+TODOS
+=====

Added: trunk/bootstrap.py
===================================================================
--- trunk/bootstrap.py	                        (rev 0)
+++ trunk/bootstrap.py	2008-11-04 17:11:48 UTC (rev 92775)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2007 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.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id: bootstrap.py 77083 2007-06-25 22:56:42Z srichter $
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+ez = {}
+exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+                     ).read() in ez
+ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+import pkg_resources
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+    cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+    os.P_WAIT, sys.executable, sys.executable,
+    '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+    dict(os.environ,
+         PYTHONPATH=
+         ws.find(pkg_resources.Requirement.parse('setuptools')).location
+         ),
+    ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)

Added: trunk/buildout.cfg
===================================================================
--- trunk/buildout.cfg	                        (rev 0)
+++ trunk/buildout.cfg	2008-11-04 17:11:48 UTC (rev 92775)
@@ -0,0 +1,7 @@
+[buildout]
+develop = .
+parts = test
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = z3c.iban [test]

Added: trunk/setup.py
===================================================================
--- trunk/setup.py	                        (rev 0)
+++ trunk/setup.py	2008-11-04 17:11:48 UTC (rev 92775)
@@ -0,0 +1,72 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation 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.
+#
+##############################################################################
+"""Setup
+
+$Id: setup.py 79605 2007-09-12 21:54:41Z hermann $
+"""
+import os
+from setuptools import setup, find_packages
+
+def read(*rnames):
+    return open(os.path.join(os.path.dirname(__file__),
+                 *rnames)).read().decode('utf-8').encode('latin-1', 'ignore')
+
+setup (
+    name='z3c.iban',
+    version='0.1.0',
+    author = "Hermann Himmelbauer",
+    author_email = "dusty at qwer.tk",
+    description = "An IBAN field and support for ``z3c.form``.",
+    long_description=(
+        read('README.txt')
+        + '\n\n' +
+        'Detailed Documentation\n'
+        '**********************\n'
+        + '\n' +
+        read('src', 'z3c', 'iban', 'README.txt')
+        + '\n\n' +
+        read('CHANGES.txt')
+        ),
+    license = "ZPL 2.1",
+    keywords = "zope3 IBAN schema field widget form",
+    classifiers = [
+        'Development Status :: 2 - Beta',
+        'Environment :: Web Environment',
+        'Intended Audience :: Developers',
+        'License :: OSI Approved :: Zope Public License',
+        'Programming Language :: Python',
+        'Natural Language :: English',
+        'Operating System :: OS Independent',
+        'Topic :: Internet :: WWW/HTTP',
+        'Framework :: Zope3'],
+    url = 'http://svn.zope.org/z3c.iban',
+    packages = find_packages('src'),
+    include_package_data = True,
+    package_dir = {'':'src'},
+    namespace_packages = ['z3c'],
+    extras_require = dict(
+        test = ['z3c.form', 'zope.testing'],
+        form = ['z3c.form'],
+        ),
+    install_requires = [
+        'setuptools',
+        'ibanlib',
+        'zope.i18n',
+        'zope.i18nmessageid',
+        'zope.interface',
+        'zope.schema',
+        ],
+    dependency_links = ['http://download.zope.org/distribution'],
+    zip_safe = False,
+    )

Added: trunk/src/z3c/__init__.py
===================================================================
--- trunk/src/z3c/__init__.py	                        (rev 0)
+++ trunk/src/z3c/__init__.py	2008-11-04 17:11:48 UTC (rev 92775)
@@ -0,0 +1,7 @@
+try:
+    # Declare this a namespace package if pkg_resources is available.
+    import pkg_resources
+    pkg_resources.declare_namespace('z3c')
+except ImportError:
+    pass
+

Added: trunk/src/z3c/iban/README.txt
===================================================================
--- trunk/src/z3c/iban/README.txt	                        (rev 0)
+++ trunk/src/z3c/iban/README.txt	2008-11-04 17:11:48 UTC (rev 92775)
@@ -0,0 +1,19 @@
+==================
+The Currency Field
+==================
+
+The IBAN field is a textual field, specifically designed to hold
+the international bank account number (IBAN).
+
+ >>> from z3c.iban import field, interfaces
+ 
+ >>> iban1 = field.IBAN(
+ ...     title=u'IBAN 1',
+ ...     description=u'IBAN Number 1')
+
+Now the field can be validated.
+
+ >>> iban1.validate('UNKNOWNIBAN')      
+ Traceback (most recent call last):
+ ...
+ ValidationError: Value is no valid IBAN

Added: trunk/src/z3c/iban/SETUP.cfg
===================================================================
--- trunk/src/z3c/iban/SETUP.cfg	                        (rev 0)
+++ trunk/src/z3c/iban/SETUP.cfg	2008-11-04 17:11:48 UTC (rev 92775)
@@ -0,0 +1,4 @@
+<data-files zopeskel/etc/package-includes>
+  z3c.iban-*.zcml
+</data-files>
+

Added: trunk/src/z3c/iban/__init__.py
===================================================================
--- trunk/src/z3c/iban/__init__.py	                        (rev 0)
+++ trunk/src/z3c/iban/__init__.py	2008-11-04 17:11:48 UTC (rev 92775)
@@ -0,0 +1 @@
+# Make a package

Added: trunk/src/z3c/iban/configure.zcml
===================================================================
--- trunk/src/z3c/iban/configure.zcml	                        (rev 0)
+++ trunk/src/z3c/iban/configure.zcml	2008-11-04 17:11:48 UTC (rev 92775)
@@ -0,0 +1,12 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope">
+
+  <adapter
+      factory="z3c.form.browser.text.TextFieldWidget"
+      for="z3c.iban.interfaces.IIBAN
+           z3c.form.interfaces.IFormLayer"
+      />
+
+
+</configure>
+

Added: trunk/src/z3c/iban/field.py
===================================================================
--- trunk/src/z3c/iban/field.py	                        (rev 0)
+++ trunk/src/z3c/iban/field.py	2008-11-04 17:11:48 UTC (rev 92775)
@@ -0,0 +1,37 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation 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.
+#
+##############################################################################
+"""IBAN Field implementation
+
+$Id: field.py 78339 2007-07-25 22:55:36Z hermann $
+"""
+
+__docformat__ = "reStructuredText"
+
+from ibanlib.iban import valid
+
+import zope.interface
+import zope.schema
+from zope.schema.fieldproperty import FieldProperty
+
+from z3c.iban import interfaces
+
+class IBAN(zope.schema.Orderable, zope.schema.Field):
+    zope.interface.implements(interfaces.IIBAN)
+
+    def _validate(self, value):
+        if not valid(value):
+            raise zope.schema.ValidationError(
+                "Value is no valid IBAN")
+        super(IBAN, self)._validate(value)
+

Added: trunk/src/z3c/iban/i18n.py
===================================================================
--- trunk/src/z3c/iban/i18n.py	                        (rev 0)
+++ trunk/src/z3c/iban/i18n.py	2008-11-04 17:11:48 UTC (rev 92775)
@@ -0,0 +1,22 @@
+##############################################################################
+#
+# Copyright (c) 2007 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.
+#
+##############################################################################
+"""I18n message factory z3c.iban
+
+$Id: i18n.py 77083 2007-06-25 22:56:42Z hermann $
+"""
+__docformat__ = "reStructuredText"
+
+import zope.i18nmessageid
+
+MessageFactory = zope.i18nmessageid.MessageFactory('z3c.iban')

Added: trunk/src/z3c/iban/interfaces.py
===================================================================
--- trunk/src/z3c/iban/interfaces.py	                        (rev 0)
+++ trunk/src/z3c/iban/interfaces.py	2008-11-04 17:11:48 UTC (rev 92775)
@@ -0,0 +1,25 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation 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.
+#
+##############################################################################
+"""IBAN Field interfaces
+
+$Id: interfaces.py 77083 2007-06-25 22:56:42Z hermann $
+"""
+__docformat__ = "reStructuredText"
+import zope.schema
+from zope.schema import interfaces
+
+from z3c.iban.i18n import MessageFactory as _
+
+class IIBAN(interfaces.IField):
+   """IBAN Field"""

Added: trunk/src/z3c/iban/tests.py
===================================================================
--- trunk/src/z3c/iban/tests.py	                        (rev 0)
+++ trunk/src/z3c/iban/tests.py	2008-11-04 17:11:48 UTC (rev 92775)
@@ -0,0 +1,32 @@
+##############################################################################
+#
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""IBAN Test Setup
+
+$Id: tests.py 77083 2007-06-25 22:56:42Z hermann $
+"""
+__docformat__ = "reStructuredText"
+
+import unittest
+from zope.testing import doctest
+from zope.testing.doctestunit import DocFileSuite
+
+def test_suite():
+    return unittest.TestSuite((
+        DocFileSuite('README.txt',
+                     optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
+                     ),
+        ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')

Added: trunk/src/z3c/iban/z3c.iban-configure.zcml
===================================================================
--- trunk/src/z3c/iban/z3c.iban-configure.zcml	                        (rev 0)
+++ trunk/src/z3c/iban/z3c.iban-configure.zcml	2008-11-04 17:11:48 UTC (rev 92775)
@@ -0,0 +1 @@
+<include package="z3c.iban" />



More information about the Checkins mailing list