[Checkins] SVN: z3c.language.negotiator/trunk/ Moved
z3c.language.negotiator to it's own top level package
Roger Ineichen
roger at projekt01.ch
Thu Nov 15 22:52:33 EST 2007
Log message for revision 81875:
Moved z3c.language.negotiator to it's own top level package
I'm not sure about the generation. The generation testing generation-0.fs
was created with a older ZODB package and fires now a lot of deprecation
warnings and fails into broken objects. I guess we should release that and
remove it in the next version.
Changed:
_U z3c.language.negotiator/trunk/
A z3c.language.negotiator/trunk/CHANGES.txt
A z3c.language.negotiator/trunk/README.txt
A z3c.language.negotiator/trunk/bootstrap.py
A z3c.language.negotiator/trunk/buildout.cfg
_U z3c.language.negotiator/trunk/externals/
A z3c.language.negotiator/trunk/setup.py
_U z3c.language.negotiator/trunk/src/
A z3c.language.negotiator/trunk/src/z3c/language/negotiator/
U z3c.language.negotiator/trunk/src/z3c/language/negotiator/README.txt
U z3c.language.negotiator/trunk/src/z3c/language/negotiator/browser/views.py
U z3c.language.negotiator/trunk/src/z3c/language/negotiator/configure.zcml
U z3c.language.negotiator/trunk/src/z3c/language/negotiator/interfaces.py
U z3c.language.negotiator/trunk/src/z3c/language/negotiator/testing.py
U z3c.language.negotiator/trunk/src/z3c/language/negotiator/tests.py
U z3c.language.negotiator/trunk/src/z3c/language/negotiator/vocabulary.py
-=-
Property changes on: z3c.language.negotiator/trunk
___________________________________________________________________
Name: svn:ignore
+ bin
.installed.cfg
develop-eggs
parts
Added: z3c.language.negotiator/trunk/CHANGES.txt
===================================================================
--- z3c.language.negotiator/trunk/CHANGES.txt (rev 0)
+++ z3c.language.negotiator/trunk/CHANGES.txt 2007-11-16 03:52:32 UTC (rev 81875)
@@ -0,0 +1,14 @@
+=======
+CHANGES
+=======
+
+Version 0.5.0 (unreleased)
+--------------------------
+
+- Removed the two vocabulary AvailableTranslationDomainLanguagesVocabulary
+ and AvailableTranslationDomainLanguagesVocabularyForZ3C which depend on the
+ zope.app.i18n implementation. Note this vocabulary are not persistent and
+ if you will need it,, let's implement this in another package. This allow us
+ to skip all dependencies to zope.app.i18n
+
+- Moved zope.language.negotiator to it's namespace package
Property changes on: z3c.language.negotiator/trunk/CHANGES.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: z3c.language.negotiator/trunk/README.txt
===================================================================
--- z3c.language.negotiator/trunk/README.txt (rev 0)
+++ z3c.language.negotiator/trunk/README.txt 2007-11-16 03:52:32 UTC (rev 81875)
@@ -0,0 +1 @@
+This package provides a persistent INegotiator utility implementation.
Property changes on: z3c.language.negotiator/trunk/README.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: z3c.language.negotiator/trunk/bootstrap.py
===================================================================
--- z3c.language.negotiator/trunk/bootstrap.py (rev 0)
+++ z3c.language.negotiator/trunk/bootstrap.py 2007-11-16 03:52:32 UTC (rev 81875)
@@ -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:$
+"""
+
+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)
Property changes on: z3c.language.negotiator/trunk/bootstrap.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: z3c.language.negotiator/trunk/buildout.cfg
===================================================================
--- z3c.language.negotiator/trunk/buildout.cfg (rev 0)
+++ z3c.language.negotiator/trunk/buildout.cfg 2007-11-16 03:52:32 UTC (rev 81875)
@@ -0,0 +1,16 @@
+[buildout]
+develop = .
+ externals/z3c.language.session
+parts = test checker coverage
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = z3c.language.negotiator [test]
+
+[checker]
+recipe = lovely.recipe:importchecker
+path = src/z3c/language/negotiator
+
+[coverage]
+recipe = zc.recipe.egg
+eggs = z3c.coverage
Property changes on: z3c.language.negotiator/trunk/externals
___________________________________________________________________
Name: svn:externals
+ z3c.language.session svn+ssh://svn.zope.org/repos/main/z3c.language.session/trunk
Added: z3c.language.negotiator/trunk/setup.py
===================================================================
--- z3c.language.negotiator/trunk/setup.py (rev 0)
+++ z3c.language.negotiator/trunk/setup.py 2007-11-16 03:52:32 UTC (rev 81875)
@@ -0,0 +1,77 @@
+##############################################################################
+#
+# 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:$
+"""
+import os
+from setuptools import setup, find_packages
+
+def read(*rnames):
+ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+setup (
+ name='z3c.language.negotiator',
+ version='0.5.0dev',
+ author = "Roger Ineichen and the Zope Community",
+ author_email = "zope3-dev at zope.org",
+ description = "Zope3 i18n language negotiator.",
+ long_description=(
+ read('README.txt')
+ + '\n\n' +
+ read('CHANGES.txt')
+ ),
+ license = "ZPL 2.1",
+ keywords = "zope3 z3c i18n language negotiator",
+ classifiers = [
+ 'Development Status :: 5 - Production/Stable',
+ '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://cheeseshop.python.org/pypi/z3c.language.negotiator',
+ packages = find_packages('src'),
+ include_package_data = True,
+ package_dir = {'':'src'},
+ namespace_packages = ['z3c', 'z3c.language'],
+ extras_require = dict(
+ test = [
+ 'zope.app.testing',
+ 'zope.testing',
+ 'z3c.testing',
+ 'z3c.coverage',
+ ],
+ ),
+ install_requires = [
+ 'setuptools',
+ 'z3c.i18n',
+ 'z3c.language.session',
+ 'zope.app.component',
+ 'zope.app.container',
+ 'zope.app.generations',
+ 'zope.app.zopeappgenerations',
+ 'zope.component',
+ 'zope.i18n',
+ 'zope.interface',
+ 'zope.publisher',
+ 'zope.schema',
+ 'zope.session',
+ ],
+ dependency_links = ['http://download.zope.org/distribution'],
+ zip_safe = False,
+ )
Property changes on: z3c.language.negotiator/trunk/setup.py
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: z3c.language.negotiator/trunk/src
___________________________________________________________________
Name: svn:ignore
+ z3c.language.negotiator.egg-info
Copied: z3c.language.negotiator/trunk/src/z3c/language/negotiator (from rev 81870, z3c.language/trunk/src/z3c/language/negotiator)
Modified: z3c.language.negotiator/trunk/src/z3c/language/negotiator/README.txt
===================================================================
--- z3c.language/trunk/src/z3c/language/negotiator/README.txt 2007-11-16 02:09:47 UTC (rev 81870)
+++ z3c.language.negotiator/trunk/src/z3c/language/negotiator/README.txt 2007-11-16 03:52:32 UTC (rev 81875)
@@ -3,7 +3,7 @@
==========
This package provides a local implementation of a INegotiator defined in
-zope.i18n.interfaces. The negotiator implementation offers soem additional
+zope.i18n.interfaces. The negotiator implementation offers some additional
usefull attributes which are explained later. This INegotiator is also used
in the z3c.language.switch package.
Modified: z3c.language.negotiator/trunk/src/z3c/language/negotiator/browser/views.py
===================================================================
--- z3c.language/trunk/src/z3c/language/negotiator/browser/views.py 2007-11-16 02:09:47 UTC (rev 81870)
+++ z3c.language.negotiator/trunk/src/z3c/language/negotiator/browser/views.py 2007-11-16 03:52:32 UTC (rev 81875)
@@ -17,23 +17,22 @@
"""
__docformat__ = 'restructuredtext'
-from zope.interface import implements
+import zope.component
+import zope.interface
from zope.i18n.interfaces import INegotiator
from zope.publisher.browser import BrowserView
-from zope.app.zapi import getUtility
-
from z3c.language.negotiator import IOfferedLanguages
class NegotiatorView(BrowserView):
- implements(IOfferedLanguages)
+ zope.interface.implements(IOfferedLanguages)
def getOfferedLanguages(self):
"""View for listing available (offered) languages."""
- negotiator = getUtility(INegotiator, '', self.context)
+ negotiator = zope.component.getUtility(INegotiator, '', self.context)
try:
offeredLanguages = negotiator.offeredLanguages
@@ -47,7 +46,7 @@
def hasOfferedLanguages(self):
"""View for to check if we have i18n session support."""
- negotiator = getUtility(INegotiator, '', self.context)
+ negotiator = zope.component.getUtility(INegotiator, '', self.context)
try:
offeredLanguages = negotiator.offeredLanguages
Modified: z3c.language.negotiator/trunk/src/z3c/language/negotiator/configure.zcml
===================================================================
--- z3c.language/trunk/src/z3c/language/negotiator/configure.zcml 2007-11-16 02:09:47 UTC (rev 81870)
+++ z3c.language.negotiator/trunk/src/z3c/language/negotiator/configure.zcml 2007-11-16 03:52:32 UTC (rev 81875)
@@ -30,13 +30,6 @@
/>
</class>
- <utility
- provides="zope.schema.interfaces.IVocabularyFactory"
- component="
- .vocabulary.AvailableTranslationDomainLanguagesVocabularyForZ3C"
- name="available z3c languages"
- />
-
<include package=".browser" />
</configure>
Modified: z3c.language.negotiator/trunk/src/z3c/language/negotiator/interfaces.py
===================================================================
--- z3c.language/trunk/src/z3c/language/negotiator/interfaces.py 2007-11-16 02:09:47 UTC (rev 81870)
+++ z3c.language.negotiator/trunk/src/z3c/language/negotiator/interfaces.py 2007-11-16 03:52:32 UTC (rev 81875)
@@ -20,13 +20,11 @@
import zope.interface
import zope.schema
from zope.schema.interfaces import IVocabularyTokenized
-
+from zope.session.interfaces import ISession
from zope.i18n.interfaces import INegotiator
-
-from zope.app.session.interfaces import ISession
-
from z3c.i18n import MessageFactory as _
+
language_policies = ['server', 'session', 'browser',
'browser --> session --> server', 'browser --> server',
'session --> browser --> server', 'session --> server']
Modified: z3c.language.negotiator/trunk/src/z3c/language/negotiator/testing.py
===================================================================
--- z3c.language/trunk/src/z3c/language/negotiator/testing.py 2007-11-16 02:09:47 UTC (rev 81870)
+++ z3c.language.negotiator/trunk/src/z3c/language/negotiator/testing.py 2007-11-16 03:52:32 UTC (rev 81875)
@@ -22,12 +22,11 @@
from zope.schema import vocabulary
from zope.i18n.interfaces import IUserPreferredLanguages
from zope.publisher.interfaces import IRequest
-from zope.app.authentication.tests import TestClientId
-from zope.app.session.interfaces import IClientId
-from zope.app.session.interfaces import IClientIdManager
-from zope.app.session.interfaces import ISessionDataContainer
-from zope.app.session.http import CookieClientIdManager
-from zope.app.session import session
+from zope.session.interfaces import IClientId
+from zope.session.interfaces import IClientIdManager
+from zope.session.interfaces import ISessionDataContainer
+from zope.session.http import CookieClientIdManager
+from zope.session import session
from z3c import testing
from z3c.language.session.interfaces import ILanguageSession
@@ -42,6 +41,12 @@
#
###############################################################################
+class TestClientId(object):
+ zope.interface.implements(IClientId)
+ def __new__(cls, request):
+ return 'dummyclientidfortesting'
+
+
class LanguageSessionStub(object):
zope.interface.implements(ILanguageSession)
Modified: z3c.language.negotiator/trunk/src/z3c/language/negotiator/tests.py
===================================================================
--- z3c.language/trunk/src/z3c/language/negotiator/tests.py 2007-11-16 02:09:47 UTC (rev 81870)
+++ z3c.language.negotiator/trunk/src/z3c/language/negotiator/tests.py 2007-11-16 03:52:32 UTC (rev 81875)
@@ -82,11 +82,10 @@
unittest.makeSuite(NegotiatorBaseTest),
unittest.makeSuite(NegotiatorTest),
DocFileSuite('README.txt',
- setUp=testing.doctestSetUp,
- tearDown=testing.doctestTearDown,
- optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
- ),
- ))
+ setUp=testing.doctestSetUp,
+ tearDown=testing.doctestTearDown,
+ optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
+ ))
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
Modified: z3c.language.negotiator/trunk/src/z3c/language/negotiator/vocabulary.py
===================================================================
--- z3c.language/trunk/src/z3c/language/negotiator/vocabulary.py 2007-11-16 02:09:47 UTC (rev 81870)
+++ z3c.language.negotiator/trunk/src/z3c/language/negotiator/vocabulary.py 2007-11-16 03:52:32 UTC (rev 81875)
@@ -17,29 +17,25 @@
"""
__docformat__ = 'restructuredtext'
-from zope.interface import classProvides
-from zope.interface.declarations import implements
-
+import zope.interface
+import zope.component
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import SimpleTerm
from zope.schema.vocabulary import SimpleVocabulary
-from zope.app.zapi import getUtility
-from zope.app.i18n.interfaces import ILocalTranslationDomain
-
from z3c.language.negotiator import interfaces
class OfferedLanguagesVocabulary(SimpleVocabulary):
"""A vocabulary of available (offered) languages."""
- implements(interfaces.IOfferedLanguagesVocabulary)
+ zope.interface.implements(interfaces.IOfferedLanguagesVocabulary)
def __init__(self, context):
terms = []
# collect offered languages
- negotiator = getUtility(interfaces.INegotiator)
+ negotiator = zope.component.getUtility(interfaces.INegotiator)
languages = negotiator.offeredLanguages
for lang in languages:
@@ -47,34 +43,3 @@
terms.sort(lambda lhs, rhs: cmp(lhs.title, rhs.title))
super(OfferedLanguagesVocabulary, self).__init__(terms)
-
-
-class AvailableTranslationDomainLanguagesVocabulary(SimpleVocabulary):
- """A vocabular of available languages from a translation domain."""
-
- implements(interfaces.IAvailableTranslationDomainLanguagesVocabulary)
-
- def __init__(self, context, domain='zope'):
- terms = []
-
- # collect languages from translation domain
- trans_domain = getUtility(ILocalTranslationDomain, domain)
- languages = trans_domain.getAvailableLanguages()
-
- for lang in languages:
- terms.append(SimpleTerm(lang, lang, lang))
-
- terms.sort(lambda lhs, rhs: cmp(lhs.title, rhs.title))
- super(AvailableTranslationDomainLanguagesVocabulary, self).__init__(
- terms)
-
-
-class AvailableTranslationDomainLanguagesVocabularyForZ3C(
- AvailableTranslationDomainLanguagesVocabulary):
- """AvailableTranslationDomainLanguagesVocabulary for z3c domain."""
-
- classProvides(IVocabularyFactory)
-
- def __init__(self, context, ):
- super(AvailableTranslationDomainLanguagesVocabulary,self).__init__(
- context, domain='z3c')
More information about the Checkins
mailing list