zope.i18nmessageid-4.0.3/0000775000175000017500000000000012312362266015044 5ustar tseavertseaverzope.i18nmessageid-4.0.3/setup.cfg0000664000175000017500000000042512312362266016666 0ustar tseavertseaver[egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 [nosetests] cover-package = zope.i18nmessageid nocapture = 1 cover-erase = 1 with-doctest = 0 where = src [aliases] dev = develop easy_install zope.i18nmessageid[testing] docs = easy_install zope.i18nmessageid[docs] zope.i18nmessageid-4.0.3/buildout.cfg0000664000175000017500000000027312073041757017361 0ustar tseavertseaver[buildout] develop = . parts = test python [test] recipe = zc.recipe.testrunner eggs = zope.i18nmessageid [python] recipe = zc.recipe.egg eggs = zope.i18nmessageid interpreter = python zope.i18nmessageid-4.0.3/PKG-INFO0000664000175000017500000001607512312362266016152 0ustar tseavertseaverMetadata-Version: 1.0 Name: zope.i18nmessageid Version: 4.0.3 Summary: Message Identifiers for internationalization Home-page: http://pypi.python.org/pypi/zope.i18nmessageid Author: Zope Foundation and Contributors Author-email: zope-dev@zope.org License: ZPL 2.1 Description: To translate any text, we must be able to discover the source domain of the text. A source domain is an identifier that identifies a project that produces program source strings. Source strings occur as literals in python programs, text in templates, and some text in XML data. The project implies a source language and an application context. We can think of a source domain as a collection of messages and associated translation strings. We often need to create unicode strings that will be displayed by separate views. The view cannot translate the string without knowing its source domain. A string or unicode literal carries no domain information, therefore we use messages. Messages are unicode strings which carry a translation source domain and possibly a default translation. They are created by a message factory. The message factory is created by calling ``MessageFactory`` with the source domain. This package provides facilities for *declaring* such messages within program source text; translation of the messages is the responsiblitiy of the 'zope.i18n' package. Please see http://docs.zope.org/zope.i18nmessageid/ for the documentation. ======= CHANGES ======= 4.0.3 (2014-03-19) ------------------ - Added support for Python 3.4. - Updated ``boostrap.py`` to version 2.2. 4.0.2 (2012-12-31) ------------------ - Fleshed out PyPI Trove classifiers. 4.0.1 (2012-11-21) ------------------ - Added support for Python 3.3. 4.0.0 (2012-05-16) ------------------ - Automated build of Sphinx HTML docs and running doctest snippets via tox. - Removed use of '2to3' and associated fixers when installing under Py3k. The code is now in a "compatible subset" which supports Python 2.6, 2.7, and 3.2, including PyPy 1.8 (the version compatible with the 2.7 language spec). - 100% unit test coverage. - Move doctest examples into Sphinx documentation. - Dropped explicit support for Python 2.4 / 2.5 / 3.1. - Added explicit support for PyPy. - Added 'setup.py dev' alias (runs ``setup.py develop`` plus installs ``nose`` and ``coverage``). - Added 'setup.py docs' alias (installs ``Sphinx`` and dependencies). 3.6.1 (2011-07-20) ------------------ - Correct metadata in this file for release date. 3.6.0 (2011-07-20) ------------------ - Python 3 support. - Don't attempt to compile C extensions on PyPy or Jython. - Add a tox.ini (see http://tox.readthedocs.org/en/latest/) for easier automated testing. 3.5.3 (2010-08-10) ------------------ - Made compilation of C extension optional again; 3.5.1 broke this inasmuch as this package become unusable on non-CPython platforms. Making the compilation of the C extension optional again implied removing ``setup.py`` code added in 3.5.1 which made the C extension a setuptools "Feature" and readding code from 3.5.0 which overrides the distutils ``build_ext`` command. - Move pickle equality tests into a unittest.TestCase test to make it easier to condition the tests on whether the C extension has been compiled. This also makes the tests pass on Jython. 3.5.2 (2010-04-30) ------------------ - Removed use of 'zope.testing.doctestunit' in favor of stdlib's 'doctest. 3.5.1 (2010-04-10) ------------------ - LP #257657 / 489529: Fix memory leak in C extension. - Fixed the compilation of the C extension with python 2.6: refactored it as a setuptools Feature. 3.5.0 (2009-06-27) ------------------ - Made compilation of C extension optional. - Added support to bootstrap on Jython. - Changed package's mailing list address from zope3-dev at zope.org to zope-dev at zope.org, because zope3-dev is now retired. - Reformatted change log to common formatting style. - Update package description and docs a little. - Remove old .cfg files for zpkg. 3.4.3 (2007-09-26) ------------------ - Make PyPI the home URL. 3.4.2 (2007-09-25) ------------------ - Moved the ``ZopeMessageFactory`` from ``zope.app.i18n`` to this package. 3.4.0 (2007-07-19) ------------------ - Remove incorrect dependency. - Create final release to reflect package status. 3.2.0 (2006-01-05) ------------------ - Corresponds to the verison of the zope.i18nmessageid package shipped as part of the Zope 3.2.0 release. - Implemented 'zope.i18nmessageid.message' as a C extension. - Deprecated 'zope.i18nmessageid.messageid' APIs ('MessageID', 'MessageIDFactory') in favor of replacements in 'zope.i18nmessageid.message' ('Message', 'MessageFactory'). Deprecated items are scheduled for removal in Zope 3.3. 3.0.0 (2004-11-07) ------------------ - Corresponds to the verison of the zope.i18nmessageid package shipped as part of the Zope X3.0.0 release. Keywords: zope i18n message factory Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Zope Public License Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Natural Language :: English Classifier: Operating System :: OS Independent Classifier: Topic :: Internet :: WWW/HTTP Classifier: Framework :: Zope3 zope.i18nmessageid-4.0.3/tox.ini0000664000175000017500000000172212312122012016340 0ustar tseavertseaver[tox] envlist = # Jython support pending 2.7 support, due 2012-07-15 or so. See: # http://fwierzbicki.blogspot.com/2012/03/adconion-to-fund-jython-27.html # py26,py27,py32,jython,pypy,coverage py26,py27,py32,py33,py34,pypy,coverage,docs [testenv] commands = python setup.py test -q [testenv:jython] commands = jython setup.py test -q [testenv:coverage] basepython = python2.6 commands = # The installed version messes up nose's test discovery / coverage reporting # So, we uninstall that from the environment, and then install the editable # version, before running nosetests. pip uninstall -y zope.i18nmessageid pip install -e . nosetests --with-xunit --with-xcoverage deps = nose coverage nosexcover [testenv:docs] basepython = python2.6 commands = sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest deps = Sphinx zope.i18nmessageid-4.0.3/.gitignore0000664000175000017500000000021112073042336017023 0ustar tseavertseaver*.pyc *.so __pycache__ build *.egg-info .installed.cfg bin develop-eggs eggs parts docs/_build .tox nosetests.xml coverage.xml .coverage zope.i18nmessageid-4.0.3/setup.py0000664000175000017500000001215212312362151016550 0ustar tseavertseaver############################################################################## # # Copyright (c) 2006 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. # ############################################################################## # This package is developed by the Zope Toolkit project, documented here: # http://docs.zope.org/zopetoolkit # When developing and releasing this package, please follow the documented # Zope Toolkit policies as described by this documentation. ############################################################################## """Setup for zope.i18nmessageid package """ import os import sys from setuptools import setup, find_packages, Extension, Feature from distutils.command.build_ext import build_ext from distutils.errors import CCompilerError from distutils.errors import DistutilsExecError from distutils.errors import DistutilsPlatformError import platform py_impl = getattr(platform, 'python_implementation', lambda: None) is_pypy = py_impl() == 'PyPy' is_jython = 'java' in sys.platform codeoptimization_c = os.path.join('src', 'zope', 'i18nmessageid', "_zope_i18nmessageid_message.c") codeoptimization = Feature( "Optional code optimizations", standard = True, ext_modules = [Extension( "zope.i18nmessageid._zope_i18nmessageid_message", [os.path.normcase(codeoptimization_c)] )]) extra = { 'extras_require': {'testing': ['nose', 'coverage'], 'docs': ['Sphinx'], }, } if not is_pypy and not is_jython: # Jython cannot build the C optimizations, while on PyPy they are # anti-optimizations (the C extension compatibility layer is known-slow, # and defeats JIT opportunities). extra['features'] = {'codeoptimization':codeoptimization} def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() class optional_build_ext(build_ext): """This class subclasses build_ext and allows the building of C extensions to fail. """ def run(self): try: build_ext.run(self) except DistutilsPlatformError: # The sys.exc_info()[1] is to preserve compatibility with both # Python 2.5 and 3.x, which is needed in setup.py. self._unavailable(sys.exc_info()[1]) def build_extension(self, ext): try: build_ext.build_extension(self, ext) except (CCompilerError, DistutilsExecError): # The sys.exc_info()[1] is to preserve compatibility with both # Python 2.5 and 3.x, which is needed in setup.py. self._unavailable(sys.exc_info()[1]) def _unavailable(self, e): # Write directly to stderr to preserve compatibility with both # Python 2.5 and 3.x, which is needed in setup.py. sys.stderr.write('*' * 80 + '\n') sys.stderr.write("""WARNING: An optional code optimization (C extension) could not be compiled. Optimizations for this package will not be available! """) sys.stderr.write(str(e) + '\n') sys.stderr.write('*' * 80 + '\n') setup(name='zope.i18nmessageid', version = '4.0.3', author='Zope Foundation and Contributors', author_email='zope-dev@zope.org', description='Message Identifiers for internationalization', long_description=( read('README.rst') + '\n\n' + read('CHANGES.rst') ), keywords = "zope i18n message factory", classifiers = [ 'Development Status :: 5 - Production/Stable', 'Environment :: Web Environment', 'Intended Audience :: Developers', 'License :: OSI Approved :: Zope Public License', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", 'Natural Language :: English', 'Operating System :: OS Independent', 'Topic :: Internet :: WWW/HTTP', 'Framework :: Zope3'], license='ZPL 2.1', url='http://pypi.python.org/pypi/zope.i18nmessageid', packages=find_packages('src'), package_dir = {'': 'src'}, namespace_packages=['zope',], install_requires=['setuptools'], include_package_data = True, test_suite='zope.i18nmessageid.tests.test_suite', zip_safe = False, cmdclass = {'build_ext':optional_build_ext}, **extra ) zope.i18nmessageid-4.0.3/bootstrap.py0000664000175000017500000001306612167126206017441 0ustar tseavertseaver############################################################################## # # Copyright (c) 2006 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. # ############################################################################## """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. """ import os import shutil import sys import tempfile from optparse import OptionParser tmpeggs = tempfile.mkdtemp() usage = '''\ [DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options] Bootstraps a buildout-based project. Simply run this script in a directory containing a buildout.cfg, using the Python that you want bin/buildout to use. Note that by using --find-links to point to local resources, you can keep this script from going over the network. ''' parser = OptionParser(usage=usage) parser.add_option("-v", "--version", help="use a specific zc.buildout version") parser.add_option("-t", "--accept-buildout-test-releases", dest='accept_buildout_test_releases', action="store_true", default=False, help=("Normally, if you do not specify a --version, the " "bootstrap script and buildout gets the newest " "*final* versions of zc.buildout and its recipes and " "extensions for you. If you use this flag, " "bootstrap and buildout will get the newest releases " "even if they are alphas or betas.")) parser.add_option("-c", "--config-file", help=("Specify the path to the buildout configuration " "file to be used.")) parser.add_option("-f", "--find-links", help=("Specify a URL to search for buildout releases")) options, args = parser.parse_args() ###################################################################### # load/install setuptools to_reload = False try: import pkg_resources import setuptools except ImportError: ez = {} try: from urllib.request import urlopen except ImportError: from urllib2 import urlopen # XXX use a more permanent ez_setup.py URL when available. exec(urlopen('https://bitbucket.org/pypa/setuptools/raw/0.7.2/ez_setup.py' ).read(), ez) setup_args = dict(to_dir=tmpeggs, download_delay=0) ez['use_setuptools'](**setup_args) if to_reload: reload(pkg_resources) import pkg_resources # This does not (always?) update the default working set. We will # do it. for path in sys.path: if path not in pkg_resources.working_set.entries: pkg_resources.working_set.add_entry(path) ###################################################################### # Install buildout ws = pkg_resources.working_set cmd = [sys.executable, '-c', 'from setuptools.command.easy_install import main; main()', '-mZqNxd', tmpeggs] find_links = os.environ.get( 'bootstrap-testing-find-links', options.find_links or ('http://downloads.buildout.org/' if options.accept_buildout_test_releases else None) ) if find_links: cmd.extend(['-f', find_links]) setuptools_path = ws.find( pkg_resources.Requirement.parse('setuptools')).location requirement = 'zc.buildout' version = options.version if version is None and not options.accept_buildout_test_releases: # Figure out the most recent final version of zc.buildout. import setuptools.package_index _final_parts = '*final-', '*final' def _final_version(parsed_version): for part in parsed_version: if (part[:1] == '*') and (part not in _final_parts): return False return True index = setuptools.package_index.PackageIndex( search_path=[setuptools_path]) if find_links: index.add_find_links((find_links,)) req = pkg_resources.Requirement.parse(requirement) if index.obtain(req) is not None: best = [] bestv = None for dist in index[req.project_name]: distv = dist.parsed_version if _final_version(distv): if bestv is None or distv > bestv: best = [dist] bestv = distv elif distv == bestv: best.append(dist) if best: best.sort() version = best[-1].version if version: requirement = '=='.join((requirement, version)) cmd.append(requirement) import subprocess if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0: raise Exception( "Failed to execute command:\n%s", repr(cmd)[1:-1]) ###################################################################### # Import and run buildout ws.add_entry(tmpeggs) ws.require(requirement) import zc.buildout.buildout if not [a for a in args if '=' not in a]: args.append('bootstrap') # if -c was provided, we push it back into args for buildout' main function if options.config_file is not None: args[0:0] = ['-c', options.config_file] zc.buildout.buildout.main(args) shutil.rmtree(tmpeggs) zope.i18nmessageid-4.0.3/.travis.yml0000664000175000017500000000027512167126152017161 0ustar tseavertseaverlanguage: python python: - 2.6 - 2.7 - 3.2 - 3.3 - pypy install: - pip install . --use-mirrors script: - python setup.py test -q notifications: email: false zope.i18nmessageid-4.0.3/src/0000775000175000017500000000000012312362266015633 5ustar tseavertseaverzope.i18nmessageid-4.0.3/src/zope.i18nmessageid.egg-info/0000775000175000017500000000000012312362266022742 5ustar tseavertseaverzope.i18nmessageid-4.0.3/src/zope.i18nmessageid.egg-info/top_level.txt0000664000175000017500000000000512312362266025467 0ustar tseavertseaverzope zope.i18nmessageid-4.0.3/src/zope.i18nmessageid.egg-info/SOURCES.txt0000664000175000017500000000431312312362266024627 0ustar tseavertseaver.gitignore .travis.yml CHANGES.rst COPYRIGHT.txt LICENSE.txt MANIFEST.in README.rst bootstrap.py buildout.cfg setup.cfg setup.py tox.ini docs/Makefile docs/api.rst docs/conf.py docs/hacking.rst docs/index.rst docs/make.bat docs/narr.rst docs/_build/doctest/output.txt docs/_build/doctrees/api.doctree docs/_build/doctrees/environment.pickle docs/_build/doctrees/hacking.doctree docs/_build/doctrees/index.doctree docs/_build/doctrees/narr.doctree docs/_build/html/.buildinfo docs/_build/html/api.html docs/_build/html/genindex.html docs/_build/html/hacking.html docs/_build/html/index.html docs/_build/html/narr.html docs/_build/html/objects.inv docs/_build/html/py-modindex.html docs/_build/html/search.html docs/_build/html/searchindex.js docs/_build/html/_modules/index.html docs/_build/html/_modules/zope/i18nmessageid/message.html docs/_build/html/_sources/api.txt docs/_build/html/_sources/hacking.txt docs/_build/html/_sources/index.txt docs/_build/html/_sources/narr.txt docs/_build/html/_static/ajax-loader.gif docs/_build/html/_static/basic.css docs/_build/html/_static/comment-bright.png docs/_build/html/_static/comment-close.png docs/_build/html/_static/comment.png docs/_build/html/_static/default.css docs/_build/html/_static/doctools.js docs/_build/html/_static/down-pressed.png docs/_build/html/_static/down.png docs/_build/html/_static/file.png docs/_build/html/_static/jquery.js docs/_build/html/_static/minus.png docs/_build/html/_static/plus.png docs/_build/html/_static/pygments.css docs/_build/html/_static/searchtools.js docs/_build/html/_static/sidebar.js docs/_build/html/_static/underscore.js docs/_build/html/_static/up-pressed.png docs/_build/html/_static/up.png docs/_build/html/_static/websupport.js src/coverage.xml src/zope/__init__.py src/zope.i18nmessageid.egg-info/PKG-INFO src/zope.i18nmessageid.egg-info/SOURCES.txt src/zope.i18nmessageid.egg-info/dependency_links.txt src/zope.i18nmessageid.egg-info/namespace_packages.txt src/zope.i18nmessageid.egg-info/not-zip-safe src/zope.i18nmessageid.egg-info/requires.txt src/zope.i18nmessageid.egg-info/top_level.txt src/zope/i18nmessageid/__init__.py src/zope/i18nmessageid/_zope_i18nmessageid_message.c src/zope/i18nmessageid/message.py src/zope/i18nmessageid/tests.pyzope.i18nmessageid-4.0.3/src/zope.i18nmessageid.egg-info/PKG-INFO0000664000175000017500000001607512312362266024050 0ustar tseavertseaverMetadata-Version: 1.0 Name: zope.i18nmessageid Version: 4.0.3 Summary: Message Identifiers for internationalization Home-page: http://pypi.python.org/pypi/zope.i18nmessageid Author: Zope Foundation and Contributors Author-email: zope-dev@zope.org License: ZPL 2.1 Description: To translate any text, we must be able to discover the source domain of the text. A source domain is an identifier that identifies a project that produces program source strings. Source strings occur as literals in python programs, text in templates, and some text in XML data. The project implies a source language and an application context. We can think of a source domain as a collection of messages and associated translation strings. We often need to create unicode strings that will be displayed by separate views. The view cannot translate the string without knowing its source domain. A string or unicode literal carries no domain information, therefore we use messages. Messages are unicode strings which carry a translation source domain and possibly a default translation. They are created by a message factory. The message factory is created by calling ``MessageFactory`` with the source domain. This package provides facilities for *declaring* such messages within program source text; translation of the messages is the responsiblitiy of the 'zope.i18n' package. Please see http://docs.zope.org/zope.i18nmessageid/ for the documentation. ======= CHANGES ======= 4.0.3 (2014-03-19) ------------------ - Added support for Python 3.4. - Updated ``boostrap.py`` to version 2.2. 4.0.2 (2012-12-31) ------------------ - Fleshed out PyPI Trove classifiers. 4.0.1 (2012-11-21) ------------------ - Added support for Python 3.3. 4.0.0 (2012-05-16) ------------------ - Automated build of Sphinx HTML docs and running doctest snippets via tox. - Removed use of '2to3' and associated fixers when installing under Py3k. The code is now in a "compatible subset" which supports Python 2.6, 2.7, and 3.2, including PyPy 1.8 (the version compatible with the 2.7 language spec). - 100% unit test coverage. - Move doctest examples into Sphinx documentation. - Dropped explicit support for Python 2.4 / 2.5 / 3.1. - Added explicit support for PyPy. - Added 'setup.py dev' alias (runs ``setup.py develop`` plus installs ``nose`` and ``coverage``). - Added 'setup.py docs' alias (installs ``Sphinx`` and dependencies). 3.6.1 (2011-07-20) ------------------ - Correct metadata in this file for release date. 3.6.0 (2011-07-20) ------------------ - Python 3 support. - Don't attempt to compile C extensions on PyPy or Jython. - Add a tox.ini (see http://tox.readthedocs.org/en/latest/) for easier automated testing. 3.5.3 (2010-08-10) ------------------ - Made compilation of C extension optional again; 3.5.1 broke this inasmuch as this package become unusable on non-CPython platforms. Making the compilation of the C extension optional again implied removing ``setup.py`` code added in 3.5.1 which made the C extension a setuptools "Feature" and readding code from 3.5.0 which overrides the distutils ``build_ext`` command. - Move pickle equality tests into a unittest.TestCase test to make it easier to condition the tests on whether the C extension has been compiled. This also makes the tests pass on Jython. 3.5.2 (2010-04-30) ------------------ - Removed use of 'zope.testing.doctestunit' in favor of stdlib's 'doctest. 3.5.1 (2010-04-10) ------------------ - LP #257657 / 489529: Fix memory leak in C extension. - Fixed the compilation of the C extension with python 2.6: refactored it as a setuptools Feature. 3.5.0 (2009-06-27) ------------------ - Made compilation of C extension optional. - Added support to bootstrap on Jython. - Changed package's mailing list address from zope3-dev at zope.org to zope-dev at zope.org, because zope3-dev is now retired. - Reformatted change log to common formatting style. - Update package description and docs a little. - Remove old .cfg files for zpkg. 3.4.3 (2007-09-26) ------------------ - Make PyPI the home URL. 3.4.2 (2007-09-25) ------------------ - Moved the ``ZopeMessageFactory`` from ``zope.app.i18n`` to this package. 3.4.0 (2007-07-19) ------------------ - Remove incorrect dependency. - Create final release to reflect package status. 3.2.0 (2006-01-05) ------------------ - Corresponds to the verison of the zope.i18nmessageid package shipped as part of the Zope 3.2.0 release. - Implemented 'zope.i18nmessageid.message' as a C extension. - Deprecated 'zope.i18nmessageid.messageid' APIs ('MessageID', 'MessageIDFactory') in favor of replacements in 'zope.i18nmessageid.message' ('Message', 'MessageFactory'). Deprecated items are scheduled for removal in Zope 3.3. 3.0.0 (2004-11-07) ------------------ - Corresponds to the verison of the zope.i18nmessageid package shipped as part of the Zope X3.0.0 release. Keywords: zope i18n message factory Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Zope Public License Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Natural Language :: English Classifier: Operating System :: OS Independent Classifier: Topic :: Internet :: WWW/HTTP Classifier: Framework :: Zope3 zope.i18nmessageid-4.0.3/src/zope.i18nmessageid.egg-info/dependency_links.txt0000664000175000017500000000000112312362266027010 0ustar tseavertseaver zope.i18nmessageid-4.0.3/src/zope.i18nmessageid.egg-info/not-zip-safe0000664000175000017500000000000112073041767025174 0ustar tseavertseaver zope.i18nmessageid-4.0.3/src/zope.i18nmessageid.egg-info/namespace_packages.txt0000664000175000017500000000000512312362266027270 0ustar tseavertseaverzope zope.i18nmessageid-4.0.3/src/zope.i18nmessageid.egg-info/requires.txt0000664000175000017500000000006212312362266025340 0ustar tseavertseaversetuptools [docs] Sphinx [testing] nose coveragezope.i18nmessageid-4.0.3/src/coverage.xml0000664000175000017500000000416412073042057020152 0ustar tseavertseaver zope.i18nmessageid-4.0.3/src/zope/0000775000175000017500000000000012312362266016610 5ustar tseavertseaverzope.i18nmessageid-4.0.3/src/zope/__init__.py0000664000175000017500000000007012073041757020721 0ustar tseavertseaver__import__('pkg_resources').declare_namespace(__name__) zope.i18nmessageid-4.0.3/src/zope/i18nmessageid/0000775000175000017500000000000012312362266021251 5ustar tseavertseaverzope.i18nmessageid-4.0.3/src/zope/i18nmessageid/__init__.py0000664000175000017500000000147312073041757023372 0ustar tseavertseaver############################################################################## # # Copyright (c) 2004 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. # ############################################################################## """I18n Messages """ from zope.i18nmessageid.message import Message, MessageFactory # import this as _ to create i18n messages in the zope domain ZopeMessageFactory = MessageFactory('zope') zope.i18nmessageid-4.0.3/src/zope/i18nmessageid/message.py0000664000175000017500000000552412073041757023260 0ustar tseavertseaver############################################################################## # # Copyright (c) 2004 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. # ############################################################################## """I18n Messages and factories. """ __docformat__ = "reStructuredText" try: unicode except NameError: #pragma NO COVER Python3 unicode = str class Message(unicode): """Message (Python implementation) This is a string used as a message. It has a domain attribute that is its source domain, and a default attribute that is its default text to display when there is no translation. domain may be None meaning there is no translation domain. default may also be None, in which case the message id itself implicitly serves as the default text. """ __slots__ = ('domain', 'default', 'mapping', '_readonly') def __new__(cls, ustr, domain=None, default=None, mapping=None): self = unicode.__new__(cls, ustr) if isinstance(ustr, self.__class__): domain = ustr.domain and ustr.domain[:] or domain default = ustr.default and ustr.default[:] or default mapping = ustr.mapping and ustr.mapping.copy() or mapping ustr = unicode(ustr) self.domain = domain if default is None: # MessageID does: self.default = ustr self.default = default else: self.default = unicode(default) self.mapping = mapping self._readonly = True return self def __setattr__(self, key, value): """Message is immutable It cannot be changed once the message id is created. """ if getattr(self, '_readonly', False): raise TypeError('readonly attribute') else: return unicode.__setattr__(self, key, value) def __getstate__(self): return unicode(self), self.domain, self.default, self.mapping def __reduce__(self): return self.__class__, self.__getstate__() # Name the fallback Python implementation to make it easier to test. pyMessage = Message try: from _zope_i18nmessageid_message import Message except ImportError: # pragma: no cover pass class MessageFactory(object): """Factory for creating i18n messages.""" def __init__(self, domain): self._domain = domain def __call__(self, ustr, default=None, mapping=None): return Message(ustr, self._domain, default, mapping) zope.i18nmessageid-4.0.3/src/zope/i18nmessageid/_zope_i18nmessageid_message.c0000664000175000017500000002060612073041757026765 0ustar tseavertseaver/*############################################################################ # # Copyright (c) 2004 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. # ############################################################################*/ #include "Python.h" /* Support for Python < 2.6: */ #ifndef Py_TYPE #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #endif #ifndef PyVarObject_HEAD_INIT #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #endif #if PY_MAJOR_VERSION >= 3 #define MOD_ERROR_VAL NULL #else #define MOD_ERROR_VAL #endif /* these macros make gc support easier; they are only available in Python 2.4 and borrowed from there */ #ifndef Py_CLEAR #define Py_CLEAR(op) \ do { \ if (op) { \ PyObject *tmp = (op); \ (op) = NULL; \ Py_DECREF(tmp); \ } \ } while (0) #endif #ifndef Py_VISIT #define Py_VISIT(op) \ do { \ if (op) { \ int vret = visit((op), arg); \ if (vret) \ return vret; \ } \ } while (0) #endif /* ----------------------------------------------------- */ typedef struct { PyUnicodeObject base; PyObject *domain; PyObject *default_; PyObject *mapping; } Message; static PyTypeObject MessageType; static PyObject * Message_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { static char *kwlist[] = {"value", "domain", "default", "mapping", NULL}; PyObject *value, *domain=NULL, *default_=NULL, *mapping=NULL, *s; Message *self; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OOO", kwlist, &value, &domain, &default_, &mapping)) return NULL; args = Py_BuildValue("(O)", value); if (args == NULL) return NULL; s = PyUnicode_Type.tp_new(type, args, NULL); Py_DECREF(args); if (s == NULL) return NULL; if (! PyObject_TypeCheck(s, &MessageType)) { PyErr_SetString(PyExc_TypeError, "unicode.__new__ didn't return a Message"); Py_DECREF(s); return NULL; } self = (Message*)s; if (PyObject_TypeCheck(value, &MessageType)) { self->domain = ((Message *)value)->domain; self->default_ = ((Message *)value)->default_; self->mapping = ((Message *)value)->mapping; } else { self->domain = self->default_ = self->mapping = NULL; } if (domain != NULL) self->domain = domain; if (default_ != NULL) self->default_ = default_; if (mapping != NULL) self->mapping = mapping; Py_XINCREF(self->mapping); Py_XINCREF(self->default_); Py_XINCREF(self->domain); return (PyObject *)self; } /* Code to access structure members by accessing attributes */ #include "structmember.h" static PyMemberDef Message_members[] = { { "domain", T_OBJECT, offsetof(Message, domain), READONLY }, { "default", T_OBJECT, offsetof(Message, default_), READONLY }, { "mapping", T_OBJECT, offsetof(Message, mapping), READONLY }, {NULL} /* Sentinel */ }; static int Message_traverse(Message *self, visitproc visit, void *arg) { Py_VISIT(self->domain); Py_VISIT(self->default_); Py_VISIT(self->mapping); return 0; } static int Message_clear(Message *self) { Py_CLEAR(self->domain); Py_CLEAR(self->default_); Py_CLEAR(self->mapping); return 0; } static void Message_dealloc(Message *self) { Message_clear(self); PyUnicode_Type.tp_dealloc((PyObject*)self); } static PyObject * Message_reduce(Message *self) { PyObject *value, *result; value = PyObject_CallFunctionObjArgs((PyObject *)&PyUnicode_Type, self, NULL); if (value == NULL) return NULL; result = Py_BuildValue("(O(OOOO))", Py_TYPE(&(self->base)), value, self->domain ? self->domain : Py_None, self->default_ ? self->default_ : Py_None, self->mapping ? self->mapping : Py_None); Py_DECREF(value); return result; } static PyMethodDef Message_methods[] = { {"__reduce__", (PyCFunction)Message_reduce, METH_NOARGS, "Reduce messages to a serializable form."}, {NULL} /* Sentinel */ }; static char MessageType__doc__[] = "Message\n" "\n" "This is a string used as a message. It has a domain attribute that is\n" "its source domain, and a default attribute that is its default text to\n" "display when there is no translation. domain may be None meaning there is\n" "no translation domain. default may also be None, in which case the\n" "message id itself implicitly serves as the default text.\n"; static PyTypeObject MessageType = { PyVarObject_HEAD_INIT(NULL, 0) /* tp_name */ "zope.i18nmessageid.message." "Message", /* tp_basicsize */ sizeof(Message), /* tp_itemsize */ 0, /* tp_dealloc */ (destructor)&Message_dealloc, /* tp_print */ (printfunc)0, /* tp_getattr */ (getattrfunc)0, /* tp_setattr */ (setattrfunc)0, /* tp_compare */ 0, /* tp_repr */ (reprfunc)0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ (hashfunc)0, /* tp_call */ (ternaryfunc)0, /* tp_str */ (reprfunc)0, /* tp_getattro */ (getattrofunc)0, /* tp_setattro */ (setattrofunc)0, /* tp_as_buffer */ 0, /* tp_flags */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_doc */ MessageType__doc__, /* tp_traverse */ (traverseproc)Message_traverse, /* tp_clear */ (inquiry)Message_clear, /* tp_richcompare */ (richcmpfunc)0, /* tp_weaklistoffset */ (long)0, /* tp_iter */ (getiterfunc)0, /* tp_iternext */ (iternextfunc)0, /* tp_methods */ Message_methods, /* tp_members */ Message_members, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* internal use */ /* tp_descr_get */ (descrgetfunc)0, /* tp_descr_set */ (descrsetfunc)0, /* tp_dictoffset */ 0, /* tp_init */ (initproc)0, /* tp_alloc */ (allocfunc)0, /* tp_new */ (newfunc)Message_new, /* tp_free */ 0, /* Low-level free-mem routine */ /* tp_is_gc */ (inquiry)0, /* For PyObject_IS_GC */ }; /* End of code for Message objects */ /* -------------------------------------------------------- */ /* List of methods defined in the module */ static struct PyMethodDef _zope_i18nmessageid_message_methods[] = { {NULL, (PyCFunction)NULL, 0, NULL}, /* sentinel */ }; static char _zope_i18nmessageid_message_module_name[] = "_zope_i18nmessageid_message"; static char _zope_i18nmessageid_message_module_documentation[] = "I18n Messages"; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, _zope_i18nmessageid_message_module_name,/* m_name */ _zope_i18nmessageid_message_module_documentation,/* m_doc */ -1,/* m_size */ _zope_i18nmessageid_message_methods,/* m_methods */ NULL,/* m_reload */ NULL,/* m_traverse */ NULL,/* m_clear */ NULL,/* m_free */ }; #endif #ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ #define PyMODINIT_FUNC void #endif PyMODINIT_FUNC #if PY_MAJOR_VERSION >= 3 PyInit__zope_i18nmessageid_message(void) #else init_zope_i18nmessageid_message(void) #endif { PyObject *m; /* Initialize types: */ MessageType.tp_base = &PyUnicode_Type; if (PyType_Ready(&MessageType) < 0) return MOD_ERROR_VAL; /* Create the module and add the functions */ #if PY_MAJOR_VERSION >= 3 m = PyModule_Create(&moduledef); #else m = Py_InitModule3(_zope_i18nmessageid_message_module_name, _zope_i18nmessageid_message_methods, _zope_i18nmessageid_message_module_documentation); #endif if (m == NULL) return MOD_ERROR_VAL; /* Add types: */ if (PyModule_AddObject(m, "Message", (PyObject *)&MessageType) < 0) return MOD_ERROR_VAL; #if PY_MAJOR_VERSION >= 3 return m; #endif } zope.i18nmessageid-4.0.3/src/zope/i18nmessageid/tests.py0000664000175000017500000001241112073041757022767 0ustar tseavertseaver############################################################################## # # Copyright (c) 2003 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. # ############################################################################## """Message ID tests. """ import unittest class PyMessageTests(unittest.TestCase): _TEST_REAOONLY = True def _getTargetClass(self): from zope.i18nmessageid.message import pyMessage return pyMessage def _makeOne(self, *args, **kw): return self._getTargetClass()(*args, **kw) def test_ctor_defaults(self): message = self._makeOne('testing') self.assertEqual(message, 'testing') self.assertEqual(message.domain, None) self.assertEqual(message.default, None) self.assertEqual(message.mapping, None) if self._TEST_REAOONLY: self.assertTrue(message._readonly) def test_ctor_explicit(self): mapping = {'key': 'value'} message = self._makeOne('testing', 'domain', 'default', mapping) self.assertEqual(message, 'testing') self.assertEqual(message.domain, 'domain') self.assertEqual(message.default, 'default') self.assertEqual(message.mapping, mapping) if self._TEST_REAOONLY: self.assertTrue(message._readonly) def test_ctor_copy(self): mapping = {'key': 'value'} source = self._makeOne('testing', 'domain', 'default', mapping) message = self._makeOne(source) self.assertEqual(message, 'testing') self.assertEqual(message.domain, 'domain') self.assertEqual(message.default, 'default') self.assertEqual(message.mapping, mapping) if self._TEST_REAOONLY: self.assertTrue(message._readonly) def test_ctor_copy_w_overrides(self): mapping = {'key': 'value'} source = self._makeOne('testing') message = self._makeOne(source, 'domain', 'default', mapping) self.assertEqual(message, 'testing') self.assertEqual(message.domain, 'domain') self.assertEqual(message.default, 'default') self.assertEqual(message.mapping, mapping) if self._TEST_REAOONLY: self.assertTrue(message._readonly) def test_domain_immutable(self): message = self._makeOne('testing') def _try(): message.domain = 'domain' self.assertRaises(TypeError, _try) def test_default_immutable(self): message = self._makeOne('testing') def _try(): message.default = 'default' self.assertRaises(TypeError, _try) def test_mapping_immutable(self): mapping = {'key': 'value'} message = self._makeOne('testing') def _try(): message.mapping = mapping self.assertRaises(TypeError, _try) def test_unknown_immutable(self): message = self._makeOne('testing') def _try(): message.unknown = 'unknown' # C version raises AttributeError, Python version TypeError self.assertRaises((TypeError, AttributeError), _try) def test___reduce__(self): mapping = {'key': 'value'} source = self._makeOne('testing') message = self._makeOne(source, 'domain', 'default', mapping) klass, state = message.__reduce__() self.assertTrue(klass is self._getTargetClass()) self.assertEqual(state, ('testing', 'domain', 'default', mapping)) class MessageTests(PyMessageTests): _TEST_REAOONLY = False def _getTargetClass(self): from zope.i18nmessageid.message import Message return Message class MessageFactoryTests(unittest.TestCase): def _getTargetClass(self): from zope.i18nmessageid.message import MessageFactory return MessageFactory def _makeOne(self, *args, **kw): return self._getTargetClass()(*args, **kw) def test___call___defaults(self): from zope.i18nmessageid.message import Message factory = self._makeOne('domain') message = factory('testing') self.assertTrue(isinstance(message, Message)) self.assertEqual(message, 'testing') self.assertEqual(message.domain, 'domain') self.assertEqual(message.default, None) self.assertEqual(message.mapping, None) def test___call___explicit(self): from zope.i18nmessageid.message import Message mapping = {'key': 'value'} factory = self._makeOne('domain') message = factory('testing', 'default', mapping) self.assertTrue(isinstance(message, Message)) self.assertEqual(message, 'testing') self.assertEqual(message.domain, 'domain') self.assertEqual(message.default, 'default') self.assertEqual(message.mapping, mapping) def test_suite(): return unittest.TestSuite(( unittest.makeSuite(PyMessageTests), unittest.makeSuite(MessageTests), unittest.makeSuite(MessageFactoryTests), )) zope.i18nmessageid-4.0.3/COPYRIGHT.txt0000664000175000017500000000004012073041757017152 0ustar tseavertseaverZope Foundation and Contributorszope.i18nmessageid-4.0.3/CHANGES.rst0000664000175000017500000000666612312362222016654 0ustar tseavertseaver======= CHANGES ======= 4.0.3 (2014-03-19) ------------------ - Added support for Python 3.4. - Updated ``boostrap.py`` to version 2.2. 4.0.2 (2012-12-31) ------------------ - Fleshed out PyPI Trove classifiers. 4.0.1 (2012-11-21) ------------------ - Added support for Python 3.3. 4.0.0 (2012-05-16) ------------------ - Automated build of Sphinx HTML docs and running doctest snippets via tox. - Removed use of '2to3' and associated fixers when installing under Py3k. The code is now in a "compatible subset" which supports Python 2.6, 2.7, and 3.2, including PyPy 1.8 (the version compatible with the 2.7 language spec). - 100% unit test coverage. - Move doctest examples into Sphinx documentation. - Dropped explicit support for Python 2.4 / 2.5 / 3.1. - Added explicit support for PyPy. - Added 'setup.py dev' alias (runs ``setup.py develop`` plus installs ``nose`` and ``coverage``). - Added 'setup.py docs' alias (installs ``Sphinx`` and dependencies). 3.6.1 (2011-07-20) ------------------ - Correct metadata in this file for release date. 3.6.0 (2011-07-20) ------------------ - Python 3 support. - Don't attempt to compile C extensions on PyPy or Jython. - Add a tox.ini (see http://tox.readthedocs.org/en/latest/) for easier automated testing. 3.5.3 (2010-08-10) ------------------ - Made compilation of C extension optional again; 3.5.1 broke this inasmuch as this package become unusable on non-CPython platforms. Making the compilation of the C extension optional again implied removing ``setup.py`` code added in 3.5.1 which made the C extension a setuptools "Feature" and readding code from 3.5.0 which overrides the distutils ``build_ext`` command. - Move pickle equality tests into a unittest.TestCase test to make it easier to condition the tests on whether the C extension has been compiled. This also makes the tests pass on Jython. 3.5.2 (2010-04-30) ------------------ - Removed use of 'zope.testing.doctestunit' in favor of stdlib's 'doctest. 3.5.1 (2010-04-10) ------------------ - LP #257657 / 489529: Fix memory leak in C extension. - Fixed the compilation of the C extension with python 2.6: refactored it as a setuptools Feature. 3.5.0 (2009-06-27) ------------------ - Made compilation of C extension optional. - Added support to bootstrap on Jython. - Changed package's mailing list address from zope3-dev at zope.org to zope-dev at zope.org, because zope3-dev is now retired. - Reformatted change log to common formatting style. - Update package description and docs a little. - Remove old .cfg files for zpkg. 3.4.3 (2007-09-26) ------------------ - Make PyPI the home URL. 3.4.2 (2007-09-25) ------------------ - Moved the ``ZopeMessageFactory`` from ``zope.app.i18n`` to this package. 3.4.0 (2007-07-19) ------------------ - Remove incorrect dependency. - Create final release to reflect package status. 3.2.0 (2006-01-05) ------------------ - Corresponds to the verison of the zope.i18nmessageid package shipped as part of the Zope 3.2.0 release. - Implemented 'zope.i18nmessageid.message' as a C extension. - Deprecated 'zope.i18nmessageid.messageid' APIs ('MessageID', 'MessageIDFactory') in favor of replacements in 'zope.i18nmessageid.message' ('Message', 'MessageFactory'). Deprecated items are scheduled for removal in Zope 3.3. 3.0.0 (2004-11-07) ------------------ - Corresponds to the verison of the zope.i18nmessageid package shipped as part of the Zope X3.0.0 release. zope.i18nmessageid-4.0.3/LICENSE.txt0000664000175000017500000000402612073041757016674 0ustar tseavertseaverZope 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. zope.i18nmessageid-4.0.3/README.rst0000664000175000017500000000221512073041757016536 0ustar tseavertseaverTo translate any text, we must be able to discover the source domain of the text. A source domain is an identifier that identifies a project that produces program source strings. Source strings occur as literals in python programs, text in templates, and some text in XML data. The project implies a source language and an application context. We can think of a source domain as a collection of messages and associated translation strings. We often need to create unicode strings that will be displayed by separate views. The view cannot translate the string without knowing its source domain. A string or unicode literal carries no domain information, therefore we use messages. Messages are unicode strings which carry a translation source domain and possibly a default translation. They are created by a message factory. The message factory is created by calling ``MessageFactory`` with the source domain. This package provides facilities for *declaring* such messages within program source text; translation of the messages is the responsiblitiy of the 'zope.i18n' package. Please see http://docs.zope.org/zope.i18nmessageid/ for the documentation. zope.i18nmessageid-4.0.3/docs/0000775000175000017500000000000012312362266015774 5ustar tseavertseaverzope.i18nmessageid-4.0.3/docs/api.rst0000664000175000017500000000037612073041757017310 0ustar tseavertseaver:mod:`zope.i18nmessageid` API Reference ======================================= :mod:`zope.i18nmessageid.message` --------------------------------- .. automodule:: zope.i18nmessageid.message .. autoclass:: Message .. autoclass:: MessageFactory zope.i18nmessageid-4.0.3/docs/make.bat0000664000175000017500000001177612073041757017420 0ustar tseavertseaver@ECHO OFF REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set BUILDDIR=_build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . set I18NSPHINXOPTS=%SPHINXOPTS% . if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% ) if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^` where ^ is one of echo. html to make standalone HTML files echo. dirhtml to make HTML files named index.html in directories echo. singlehtml to make a single large HTML file echo. pickle to make pickle files echo. json to make JSON files echo. htmlhelp to make HTML files and a HTML help project echo. qthelp to make HTML files and a qthelp project echo. devhelp to make HTML files and a Devhelp project echo. epub to make an epub echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter echo. text to make text files echo. man to make manual pages echo. texinfo to make Texinfo files echo. gettext to make PO message catalogs echo. changes to make an overview over all changed/added/deprecated items echo. linkcheck to check all external links for integrity echo. doctest to run all doctests embedded in the documentation if enabled goto end ) if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* goto end ) if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "singlehtml" ( %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "htmlhelp" ( %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. goto end ) if "%1" == "qthelp" ( %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: echo.^> qcollectiongenerator %BUILDDIR%\qthelp\zopei18nmessageid.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\zopei18nmessageid.ghc goto end ) if "%1" == "devhelp" ( %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp if errorlevel 1 exit /b 1 echo. echo.Build finished. goto end ) if "%1" == "epub" ( %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub if errorlevel 1 exit /b 1 echo. echo.Build finished. The epub file is in %BUILDDIR%/epub. goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex if errorlevel 1 exit /b 1 echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "text" ( %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text if errorlevel 1 exit /b 1 echo. echo.Build finished. The text files are in %BUILDDIR%/text. goto end ) if "%1" == "man" ( %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man if errorlevel 1 exit /b 1 echo. echo.Build finished. The manual pages are in %BUILDDIR%/man. goto end ) if "%1" == "texinfo" ( %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo if errorlevel 1 exit /b 1 echo. echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. goto end ) if "%1" == "gettext" ( %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale if errorlevel 1 exit /b 1 echo. echo.Build finished. The message catalogs are in %BUILDDIR%/locale. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes if errorlevel 1 exit /b 1 echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "linkcheck" ( %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck if errorlevel 1 exit /b 1 echo. echo.Link check complete; look for any errors in the above output ^ or in %BUILDDIR%/linkcheck/output.txt. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest if errorlevel 1 exit /b 1 echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) :end zope.i18nmessageid-4.0.3/docs/Makefile0000664000175000017500000001275012073041757017444 0ustar tseavertseaver# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/zopei18nmessageid.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/zopei18nmessageid.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/zopei18nmessageid" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/zopei18nmessageid" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." zope.i18nmessageid-4.0.3/docs/conf.py0000664000175000017500000001771212073041757017306 0ustar tseavertseaver# -*- coding: utf-8 -*- # # zope.i18nmessageid documentation build configuration file, created by # sphinx-quickstart on Fri Apr 6 17:37:16 2012. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.viewcode'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'zope.i18nmessageid' copyright = u'2012, Zope Foundation contributors' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '4.0' # The full version, including alpha/beta/rc tags. release = '4.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'zopei18nmessageiddoc' # -- Options for LaTeX output -------------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'zopei18nmessageid.tex', u'zope.i18nmessageid Documentation', u'Zope Foundation contributors', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'zopei18nmessageid', u'zope.i18nmessageid Documentation', [u'Zope Foundation contributors'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------------ # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'zopei18nmessageid', u'zope.i18nmessageid Documentation', u'Zope Foundation contributors', 'zopei18nmessageid', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {'http://docs.python.org/': None} zope.i18nmessageid-4.0.3/docs/index.rst0000664000175000017500000000036312073041757017642 0ustar tseavertseaver:mod:`zope.i18nmessageid` Documentation ======================================= Contents: .. toctree:: :maxdepth: 2 narr api hacking Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` zope.i18nmessageid-4.0.3/docs/narr.rst0000664000175000017500000001117212073041757017475 0ustar tseavertseaverUsing :mod:`zope.i18nmessageid` =============================== Rationale --------- To translate any text, we must be able to discover the source domain of the text. A source domain is an identifier that identifies a project that produces program source strings. Source strings occur as literals in python programs, text in templates, and some text in XML data. The project implies a source language and an application context. Messages and Domains -------------------- We can think of a source domain as a collection of messages and associated translation strings. The domain helps to disambiguate messages based on context: for instance, the message whose source string is ``draw`` means one thing in a first-person shooter game, and quite another in a graphics package: in the first case, the domain for the message might be ``ok_corral``, while in the second it might be ``gimp``. We often need to create unicode strings that will be displayed by separate views. The view cannot translate the string without knowing its source domain. A string or unicode literal carries no domain information, therefore we use instances of the :class:`~zope.i18nmessageid.message.Message` class. Messages are unicode strings which carry a translation source domain and possibly a default translation. Message Factories ----------------- Messages are created by a message factory belonging to a given translation domain. Each message factory is created by instantiating a :class:`~zope.i18nmessageid.message.MessageFactory`, passing the domain corresponding to the project which manages the corrresponding translations. .. doctest:: >>> from zope.i18nmessageid import MessageFactory >>> factory = MessageFactory('myproject') >>> foo = factory('foo') >>> foo.domain 'myproject' The Zope project uses the ``zope`` domain for its messages. This package exports an already-created factory for that domain: .. doctest:: >>> from zope.i18nmessageid import ZopeMessageFactory as _z_ >>> foo = _z_('foo') >>> foo.domain 'zope' Example Usage ------------- In this example, we create a message factory and assign it to _. By convention, we use _ as the name of our factory to be compatible with translatable string extraction tools such as xgettext. We then call _ with a string that needs to be translatable: .. doctest:: >>> from zope.i18nmessageid import MessageFactory, Message >>> _ = MessageFactory("futurama") >>> robot = _(u"robot-message", u"${name} is a robot.") Messages at first seem like they are unicode strings: .. doctest:: >>> robot == u'robot-message' True >>> isinstance(robot, unicode) True The additional domain, default and mapping information is available through attributes: .. doctest:: >>> robot.default == u'${name} is a robot.' True >>> robot.mapping >>> robot.domain 'futurama' The message's attributes are considered part of the immutable message object. They cannot be changed once the message id is created: .. doctest:: >>> robot.domain = "planetexpress" Traceback (most recent call last): ... TypeError: readonly attribute >>> robot.default = u"${name} is not a robot." Traceback (most recent call last): ... TypeError: readonly attribute >>> robot.mapping = {u'name': u'Bender'} Traceback (most recent call last): ... TypeError: readonly attribute If you need to change their information, you'll have to make a new message id object: .. doctest:: >>> new_robot = Message(robot, mapping={u'name': u'Bender'}) >>> new_robot == u'robot-message' True >>> new_robot.domain 'futurama' >>> new_robot.default == u'${name} is a robot.' True >>> new_robot.mapping == {u'name': u'Bender'} True Last but not least, messages are reduceable for pickling: .. doctest:: >>> callable, args = new_robot.__reduce__() >>> callable is Message True >>> args == (u'robot-message', ... 'futurama', ... u'${name} is a robot.', ... {u'name': u'Bender'}) True >>> fembot = Message(u'fembot') >>> callable, args = fembot.__reduce__() >>> callable is Message True >>> args == (u'fembot', None, None, None) True Pickling and unpickling works, which means we can store message IDs in a database: .. doctest:: >>> from pickle import dumps, loads >>> pystate = dumps(new_robot) >>> pickle_bot = loads(pystate) >>> (pickle_bot, ... pickle_bot.domain, ... pickle_bot.default, ... pickle_bot.mapping) == (u'robot-message', ... 'futurama', ... u'${name} is a robot.', ... {u'name': u'Bender'}) True >>> pickle_bot.__reduce__()[0] is Message True zope.i18nmessageid-4.0.3/docs/hacking.rst0000664000175000017500000002317712073041757020147 0ustar tseavertseaverHacking on :mod:`zope.i18nmessageid` ==================================== Getting the Code ----------------- The main repository for :mod:`zope.i18nmessageid` is in the Zope Subversion repository: http://svn.zope.org/zope.8nmessageid You can get a read-only Subversion checkout from there: .. code-block:: sh $ svn checkout svn://svn.zope.org/repos/main/zope.8nmessageid/trunk zope.i8nmessageid The project also mirrors the trunk from the Subversion repository as a Bazaar branch on Launchpad: https://code.launchpad.net/zope.i8nmessageid You can branch the trunk from there using Bazaar: .. code-block:: sh $ bzr branch lp:zope.i8nmessageid Running the tests in a ``virtualenv`` ------------------------------------- If you use the ``virtualenv`` package to create lightweight Python development environments, you can run the tests using nothing more than the ``python`` binary in a virtualenv. First, create a scratch environment: .. code-block:: sh $ /path/to/virtualenv --no-site-packages /tmp/hack-zope.i18nmessageid Next, get this package registered as a "development egg" in the environment: .. code-block:: sh $ /tmp/hack-zope.i8nmessageid/bin/python setup.py develop Finally, run the tests using the build-in ``setuptools`` testrunner: .. code-block:: sh $ /tmp/hack-zope.i8nmessageid/bin/python setup.py test -q running test .................... ---------------------------------------------------------------------- Ran 20 tests in 0.001s OK The ``dev`` command alias downloads and installs extra tools, like the :mod:`nose` testrunner and the :mod:`coverage` coverage analyzer: .. code-block:: sh $ /tmp/hack-zope.i8nmessageid/bin/python setup.py dev $ /tmp/hack-zope.i8nmessageid/bin/nosetests running nosetests .................... ---------------------------------------------------------------------- Ran 20 tests in 0.030s OK If you have the :mod:`coverage` pacakge installed in the virtualenv, you can see how well the tests cover the code: .. code-block:: sh $ /tmp/hack-zope.i8nmessageid/bin/nosetests --with coverage running nosetests .................... Name Stmts Miss Cover Missing ---------------------------------------------------------- zope.i18nmessageid 3 0 100% zope.i18nmessageid.message 36 0 100% ---------------------------------------------------------- TOTAL 39 0 100% ---------------------------------------------------------------------- Ran 21 tests in 0.036s OK Building the documentation in a ``virtualenv`` ---------------------------------------------- :mod:`zope.i18nmessageid` uses the nifty :mod:`Sphinx` documentation system for building its docs. Using the same virtualenv you set up to run the tests, you can build the docs: The ``docs`` command alias downloads and installs Sphinx and its dependencies: .. code-block:: sh $ /tmp/hack-zope.i8nmessageid/bin/python setup.py docs ... $ bin/sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html ... build succeeded. You can also test the code snippets in the documentation: .. code-block:: sh $ bin/sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest ... running tests... Document: index --------------- 1 items passed all tests: 17 tests in default 17 tests in 1 items. 17 passed and 0 failed. Test passed. Doctest summary =============== 17 tests 0 failures in tests 0 failures in setup code build succeeded. Running the tests using :mod:`zc.buildout` ------------------------------------------- :mod:`zope.i18nmessageid` ships with its own :file:`buildout.cfg` file and :file:`bootstrap.py` for setting up a development buildout: .. code-block:: sh $ /path/to/python2.6 bootstrap.py ... Generated script '.../bin/buildout' $ bin/buildout Develop: '/home/tseaver/projects/Zope/BTK/i18nmessageid/.' ... Generated script '.../bin/sphinx-quickstart'. Generated script '.../bin/sphinx-build'. You can now run the tests: .. code-block:: sh $ bin/test --all Running zope.testing.testrunner.layer.UnitTests tests: Set up zope.testing.testrunner.layer.UnitTests in 0.000 seconds. Ran 702 tests with 0 failures and 0 errors in 0.000 seconds. Tearing down left over layers: Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds. Building the documentation using :mod:`zc.buildout` --------------------------------------------------- The :mod:`zope.i18nmessageid` buildout installs the Sphinx scripts required to build the documentation, including testing its code snippets: .. todo:: verify this! .. code-block:: sh $ cd docs $ PATH=../bin:$PATH make doctest html .../bin/sphinx-build -b doctest -d .../docs/_build/doctrees .../docs .../docs/_build/doctest running tests... Document: index --------------- 1 items passed all tests: 17 tests in default 17 tests in 1 items. 17 passed and 0 failed. Test passed. Doctest summary =============== 17 tests 0 failures in tests 0 failures in setup code build succeeded. Testing of doctests in the sources finished, look at the results in .../docs/_build/doctest/output.txt. .../bin/sphinx-build -b html -d .../docs/_build/doctrees .../docs .../docs/_build/html ... build succeeded. Build finished. The HTML pages are in .../docs/_build/html. Running Tests on Multiple Python Versions via :mod:`tox` -------------------------------------------------------- `tox `_ is a Python-based test automation tool designed to run tests against multiple Python versions. It creates a ``virtualenv`` for each configured version, installs the current package and configured dependencies into each ``virtualenv``, and then runs the configured commands. :mod:`zope.i18nmessageid` configures the following :mod:`tox` environments via its ``tox.ini`` file: - The ``py26`` environment builds a ``virtualenv`` with ``python2.6``, installs :mod:`zope.i18nmessageid` and dependencies, and runs the tests via ``python setup.py test -q``. - The ``py27`` environment builds a ``virtualenv`` with ``python2.7``, installs :mod:`zope.i18nmessageid` and dependencies, and runs the tests via ``python setup.py test -q``. - The ``py32`` environment builds a ``virtualenv`` with ``python3.2``, installs :mod:`zope.i18nmessageid` and dependencies, and runs the tests via ``python setup.py test -q``. - The ``pypy`` environment builds a ``virtualenv`` with ``pypy``, installs :mod:`zope.i18nmessageid` and dependencies, and runs the tests via ``python setup.py test -q``. - The ``coverage`` environment builds a ``virtualenv`` with ``python2.6``, installs :mod:`zope.i18nmessageid` and dependencies, installs :mod:`nose` and :mod:`coverage`, and runs ``nosetests`` with statement coverage. - The ``docs`` environment builds a virtualenv with ``python2.6``, installs :mod:`zope.i18nmessageid` and dependencies, installs ``Sphinx`` and dependencies, and then builds the docs and exercises the doctest snippets. This example requires that you have a working ``python2.6`` on your path, as well as installing ``tox``: .. code-block:: sh $ tox -e py26 GLOB sdist-make: .../zope.i18nmessageid/setup.py py26 sdist-reinst: .../zope.i18nmessageid/.tox/dist/zope.i18nmessageid-4.0.2dev.zip py26 runtests: commands[0] ... ---------------------------------------------------------------------- Ran 1341 tests in 0.477s OK ___________________________________ summary ____________________________________ py26: commands succeeded congratulations :) Running ``tox`` with no arguments runs all the configured environments, including building the docs and testing their snippets: .. code-block:: sh $ tox GLOB sdist-make: .../zope.i18nmessageid/setup.py py26 sdist-reinst: .../zope.i18nmessageid/.tox/dist/zope.i18nmessageid-4.0.2dev.zip py26 runtests: commands[0] ... Doctest summary =============== 678 tests 0 failures in tests 0 failures in setup code 0 failures in cleanup code build succeeded. ___________________________________ summary ____________________________________ py26: commands succeeded py27: commands succeeded py32: commands succeeded pypy: commands succeeded coverage: commands succeeded docs: commands succeeded congratulations :) Submitting a Bug Report ----------------------- :mod:`zope.i18nmessageid` tracks its bugs on Launchpad: https://bugs.launchpad.net/zope.i18nmessageid Please submit bug reports and feature requests there. Sharing Your Changes -------------------- .. note:: Please ensure that all tests are passing before you submit your code. If possible, your submission should include new tests for new features or bug fixes, although it is possible that you may have tested your new code by updating existing tests. If you got a read-only checkout from the Subversion repository, and you have made a change you would like to share, the best route is to let Subversion help you make a patch file: .. code-block:: sh $ svn diff > zope.i18nmessageid-cool_feature.patch You can then upload that patch file as an attachment to a Launchpad bug report. If you branched the code from Launchpad using Bazaar, you have another option: you can "push" your branch to Launchpad: .. code-block:: sh $ bzr push lp:~tseaver/zope.i18nmessageid/cool_feature After pushing your branch, you can link it to a bug report on Launchpad, or request that the maintainers merge your branch using the Launchpad "merge request" feature. zope.i18nmessageid-4.0.3/MANIFEST.in0000664000175000017500000000024212074063361016577 0ustar tseavertseaverinclude *.rst include *.txt recursive-include docs * recursive-include src * global-exclude *.dll global-exclude *.pyc global-exclude *.pyo global-exclude *.so