[Testbot] Plone 4.3 - Python 2.7 - Build # 2567 - Still failing! - 5 failure(s)

jenkins at plone.org jenkins at plone.org
Mon Sep 22 16:34:58 UTC 2014


-------------------------------------------------------------------------------
Plone 4.3 - Python 2.7 - Build # 2567 - Still Failing!
-------------------------------------------------------------------------------

http://jenkins.plone.org/job/plone-4.3-python-2.7/2567/


-------------------------------------------------------------------------------
CHANGES
-------------------------------------------------------------------------------

Repository: plone.app.textfield
Branch: refs/heads/master
Date: 2014-07-03T11:36:03+01:00
Author: Jamie Lentin (lentinj) <jm at lentin.co.uk>
Commit: https://github.com/plone/plone.app.textfield/commit/e3b56a47862ff8d2ae4426391a4846b9bfdd5665

Use closest_content to find some usable content for portal_url

Files changed:
M docs/HISTORY.txt
M plone/app/textfield/widget.py

diff --git a/docs/HISTORY.txt b/docs/HISTORY.txt
index 4831d92..bd96524 100644
--- a/docs/HISTORY.txt
+++ b/docs/HISTORY.txt
@@ -4,6 +4,10 @@ Changelog
 1.2.4 (unreleased)
 ------------------
 
+* Use closest_content to navigate through the sea of subforms to
+  find something that we can use portal_url on.
+  [lentinj]
+
 - Do not give an error when the raw value is not unicode and isn't
   ascii. In that case, encode as unicode then decode as the proper
   string, bang head on desk.
diff --git a/plone/app/textfield/widget.py b/plone/app/textfield/widget.py
index af87f9d..734b73a 100644
--- a/plone/app/textfield/widget.py
+++ b/plone/app/textfield/widget.py
@@ -12,6 +12,7 @@
 
 from plone.app.textfield.interfaces import IRichText, IRichTextValue
 from plone.app.textfield.value import RichTextValue
+from plone.app.z3cform.utils import closest_content
 
 from plone.app.textfield.utils import getAllowedContentTypes
 
@@ -33,6 +34,7 @@ def update(self):
     
     def wrapped_context(self):
         context = self.context
+        content = closest_content(context)
         # We'll wrap context in the current site *if* it's not already
         # wrapped.  This allows the template to acquire tools with
         # ``context/portal_this`` if context is not wrapped already.
@@ -41,10 +43,7 @@ def wrapped_context(self):
         # short-circuiting path traversal. :-s
         if context.__class__ == dict:
             context = UserDict(self.context)
-        if context is not None and getattr(context, 'aq_inner', None) is None:
-            context = ImplicitAcquisitionWrapper(
-                context, self.form.context)
-        return context
+        return ImplicitAcquisitionWrapper(context, content)
     
     def extract(self, default=NOVALUE):
         raw = self.request.get(self.name, default)


Repository: plone.app.textfield
Branch: refs/heads/master
Date: 2014-07-25T14:41:36+01:00
Author: Jamie Lentin (lentinj) <jm at lentin.co.uk>
Commit: https://github.com/plone/plone.app.textfield/commit/a810a6664f544bdbc8893546d3e2a253f09211e9

Merge remote-tracking branch 'origin/master'

Conflicts:
	plone/app/textfield/widget.py

Files changed:
A README.rst
A bootstrap.py
A buildout.cfg
M .gitignore
M plone/app/textfield/__init__.py
M plone/app/textfield/browser.py
M plone/app/textfield/editor.py
M plone/app/textfield/handler.py
M plone/app/textfield/marshaler.py
M plone/app/textfield/tests.py
M plone/app/textfield/transform.py
M plone/app/textfield/utils.py
M plone/app/textfield/value.py
M plone/app/textfield/widget.py
M setup.py

diff --git a/.gitignore b/.gitignore
index 74b79c6..0ba644f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,13 @@
 plone.app.textfield.egg-info
-*.pyc
-*.pyo
-.pydevproject
+*.py[co]
+*.mo
+build
+dist
 .project
+.pydevproject
+.settings
+.installed.cfg
+/bin
+/develop-eggs
+/parts
+*.bak
diff --git a/README.rst b/README.rst
new file mode 120000
index 0000000..c3ca074
--- /dev/null
+++ b/README.rst
@@ -0,0 +1 @@
+README.txt
\ No newline at end of file
diff --git a/bootstrap.py b/bootstrap.py
new file mode 100644
index 0000000..ed57894
--- /dev/null
+++ b/bootstrap.py
@@ -0,0 +1,178 @@
+##############################################################################
+#
+# 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"))
+parser.add_option("--allow-site-packages",
+                  action="store_true", default=False,
+                  help=("Let bootstrap.py use existing site packages"))
+
+
+options, args = parser.parse_args()
+
+######################################################################
+# load/install setuptools
+
+try:
+    if options.allow_site_packages:
+        import setuptools
+        import pkg_resources
+    from urllib.request import urlopen
+except ImportError:
+    from urllib2 import urlopen
+
+ez = {}
+exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez)
+
+if not options.allow_site_packages:
+    # ez_setup imports site, which adds site packages
+    # this will remove them from the path to ensure that incompatible versions 
+    # of setuptools are not in the path
+    import site
+    # inside a virtualenv, there is no 'getsitepackages'. 
+    # We can't remove these reliably
+    if hasattr(site, 'getsitepackages'):
+        for sitepackage_path in site.getsitepackages():
+            sys.path[:] = [x for x in sys.path if sitepackage_path not in x]
+
+setup_args = dict(to_dir=tmpeggs, download_delay=0)
+ez['use_setuptools'](**setup_args)
+import setuptools
+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)
diff --git a/buildout.cfg b/buildout.cfg
new file mode 100644
index 0000000..d1e5a65
--- /dev/null
+++ b/buildout.cfg
@@ -0,0 +1,7 @@
+[buildout]
+extends = https://raw.githubusercontent.com/collective/buildout.plonetest/master/test-5.x.cfg
+package-name = plone.app.textfield
+package-extras = [tests]
+
+[versions]
+plone.app.textfield = 
diff --git a/plone/app/textfield/__init__.py b/plone/app/textfield/__init__.py
index 345df57..306a089 100644
--- a/plone/app/textfield/__init__.py
+++ b/plone/app/textfield/__init__.py
@@ -13,7 +13,6 @@
 from plone.app.textfield.value import RichTextValue
 
 
-
 class RichText(Object):
     """Text field that also stores MIME type
     """
diff --git a/plone/app/textfield/browser.py b/plone/app/textfield/browser.py
index e2d3312..b3870d3 100644
--- a/plone/app/textfield/browser.py
+++ b/plone/app/textfield/browser.py
@@ -3,6 +3,7 @@
 
 from plone.app.textfield.interfaces import ITransformer
 
+
 class Transform(BrowserView):
     """Invoke a transformation on a RichText field.
 
@@ -45,7 +46,7 @@ def __call__(self, value=None, fieldName=None, mimeType=None):
             if not self.major or not self.minor:
                 mimeType = value.outputMimeType
             else:
-                mimeType = "%s/%s" % (self.major, self.minor,)
+                mimeType = "%s/%s" % (self.major, self.minor, )
 
         transformer = ITransformer(context)
         return transformer(value, mimeType)
diff --git a/plone/app/textfield/editor.py b/plone/app/textfield/editor.py
index b389ad3..e6b968d 100644
--- a/plone/app/textfield/editor.py
+++ b/plone/app/textfield/editor.py
@@ -10,6 +10,7 @@
 
 try:
     import plone.app.vocabularies
+    plone.app.vocabularies    # make pyflakes happy
     HAS_VOCABS = True
 except ImportError:
     HAS_VOCABS = False
@@ -19,9 +20,9 @@ class IRichText(interfaces.IRichText, schema_ifaces.IFromUnicode):
 
     if HAS_VOCABS:
         default_mime_type = schema.Choice(
-            title = _(u'Input format'),
-            vocabulary = 'plone.app.vocabularies.AllowedContentTypes',
-            default = 'text/html',
+            title=_(u'Input format'),
+            vocabulary='plone.app.vocabularies.AllowedContentTypes',
+            default='text/html',
             )
     else:
         default_mime_type = Attribute('')
@@ -31,5 +32,4 @@ class IRichText(interfaces.IRichText, schema_ifaces.IFromUnicode):
     output_mime_type = Attribute('')
     allowed_mime_types = Attribute('')
 
-
 RichTextFactory = FieldFactory(RichText, _(u'Rich Text'))
diff --git a/plone/app/textfield/handler.py b/plone/app/textfield/handler.py
index df71f9e..aaddec0 100644
--- a/plone/app/textfield/handler.py
+++ b/plone/app/textfield/handler.py
@@ -3,36 +3,37 @@
     HAVE_SUPERMODEL = True
 except ImportError:
     HAVE_SUPERMODEL = False
-    
-if HAVE_SUPERMODEL:
 
+if HAVE_SUPERMODEL:
     
     from zope.interface import implements
     from zope.component import adapts
     from plone.app.textfield import RichText
     from plone.supermodel.interfaces import IToUnicode
     from plone.app.textfield.interfaces import IRichText
-    
+
+
     class RichTextHandler_(BaseHandler):
         """Special handling for the RichText field, to deal with 'default'
         that may be unicode.
         """
-    
+
         # Don't read or write 'schema'
         filteredAttributes = BaseHandler.filteredAttributes.copy()
         filteredAttributes.update({'schema': 'rw'})
-    
+
         def __init__(self, klass):
             super(RichTextHandler_, self).__init__(klass)
-        
+
+
     class RichTextToUnicode(object):
         implements(IToUnicode)
         adapts(IRichText)
-        
+
         def __init__(self, context):
             self.context = context
-        
+
         def toUnicode(self, value):
             return value.raw
-    
+
     RichTextHandler = RichTextHandler_(RichText)
diff --git a/plone/app/textfield/marshaler.py b/plone/app/textfield/marshaler.py
index f5e728b..41a17f2 100644
--- a/plone/app/textfield/marshaler.py
+++ b/plone/app/textfield/marshaler.py
@@ -8,23 +8,24 @@
 
     from zope.interface import Interface
     from zope.component import adapts
-    
+
     from plone.app.textfield.interfaces import IRichText
     from plone.app.textfield.value import RichTextValue
-    
+
+
     class RichTextFieldMarshaler(BaseFieldMarshaler):
         """Field marshaler for plone.app.textfield values.
         """
-        
+
         adapts(Interface, IRichText)
-        
+
         ascii = False
-        
+
         def encode(self, value, charset='utf-8', primary=False):
             if value is None:
                 return
             return value.raw.encode(charset)
-        
+
         def decode(self, value, message=None, charset='utf-8', contentType=None, primary=False):
             return RichTextValue(
                     raw=value,
@@ -32,7 +33,7 @@ def decode(self, value, message=None, charset='utf-8', contentType=None, primary
                     outputMimeType=self.field.output_mime_type,
                     encoding=charset
                 )
-        
+
         def getContentType(self):
             value = self._query()
             if value is None:
diff --git a/plone/app/textfield/tests.py b/plone/app/textfield/tests.py
index 1a3228f..d28fba2 100644
--- a/plone/app/textfield/tests.py
+++ b/plone/app/textfield/tests.py
@@ -1,49 +1,41 @@
 import doctest
 import unittest
-import zope.component.testing
-
-from Products.PloneTestCase import ptc
-import collective.testcaselayer.ptc
 
 import plone.app.textfield
+from plone.app.testing.bbb import PloneTestCase
+from plone.app import testing
+from plone.testing import layered
+
 
-ptc.setupPloneSite()
+class IntegrationFixture(testing.PloneSandboxLayer):
 
-class UnitTestLayer:
-    
-    @classmethod
-    def testTearDown(cls):
-        zope.component.testing.tearDown()
+    defaultBases = (testing.PLONE_FIXTURE, )
 
-class IntegrationTestLayer(collective.testcaselayer.ptc.BasePTCLayer):
+    def setUpZope(self, app, configurationContext):
+        self.loadZCML(package=plone.app.textfield)
 
-    def afterSetUp(self):
-        from Products.Five import zcml
-        from Products.Five import fiveconfigure
-        
-        fiveconfigure.debug_mode = True
-        zcml.load_config('configure.zcml', package=plone.app.textfield)
-        fiveconfigure.debug_mode = False
+PTC_FIXTURE = IntegrationFixture()
+IntegrationLayer = testing.FunctionalTesting(
+    bases=(PTC_FIXTURE, ), name='PloneAppTextfieldTest:Functional')
 
-IntegrationLayer = IntegrationTestLayer([collective.testcaselayer.ptc.ptc_layer])
 
-class TestIntegration(ptc.PloneTestCase):
-    
+class TestIntegration(PloneTestCase):
+
     layer = IntegrationLayer
 
     def testTransformPlain(self):
         from zope.interface import Interface
         from plone.app.textfield import RichText
-        
+
         class IWithText(Interface):
-            
+
             text = RichText(title=u"Text",
                             default_mime_type='text/plain',
                             output_mime_type='text/html')
-        
+
         value = IWithText['text'].fromUnicode(u"Some **text**")
         self.assertEquals(u'<p>Some **text**</p>', value.output)
-    
+
     def testTransformNone(self):
         from plone.app.textfield.value import RichTextValue
         value = RichTextValue()
@@ -54,42 +46,42 @@ def testTransformNone(self):
     def testTransformStructured(self):
         from zope.interface import Interface
         from plone.app.textfield import RichText
-        
+
         class IWithText(Interface):
-            
+
             text = RichText(title=u"Text",
                             default_mime_type='text/structured',
                             output_mime_type='text/html')
-        
+
         value = IWithText['text'].fromUnicode(u"Some **text**")
         self.assertEquals(u'<p>Some <strong>text</strong></p>\n', value.output)
-    
+
     def testTransformView(self):
         from zope.interface import Interface, implements
         from plone.app.textfield import RichText
         from Products.CMFCore.PortalContent import PortalContent
-        
+
         class IWithText(Interface):
-            
+
             text = RichText(title=u"Text",
                             default_mime_type='text/structured',
                             output_mime_type='text/html')
-        
+
         class Context(PortalContent):
             implements(IWithText)
-            
+
             id = 'context'
             text = None
-        
+
         context = Context()
         context.text = IWithText['text'].fromUnicode(u"Some **text**")
-        
+
         self.portal._setObject('context', context)
         context = self.portal['context']
-        
+
         output = context.restrictedTraverse('@@text-transform/text')()
         self.assertEquals(u'<p>Some <strong>text</strong></p>', output.strip())
-        
+
         output = context.restrictedTraverse('@@text-transform/text/text/plain')()
         self.assertEquals(u'Some text', output.strip())
 
@@ -103,7 +95,7 @@ class IWithText(Interface):
         context.text = IWithText['text'].fromUnicode(u"<span>Some html</span>")
         output = context.restrictedTraverse('@@text-transform/text')()
         self.assertEquals(u"<span>Some html</span>", output.strip())
-    
+
     def testTransformNoneView(self):
         from zope.interface import Interface, implements
         from plone.app.textfield import RichText
@@ -143,32 +135,32 @@ def testWidgetExtract(self):
         from plone.app.textfield.widget import RichTextWidget
         from z3c.form.widget import FieldWidget
         from z3c.form.interfaces import NOVALUE
-        
+
         class IWithText(Interface):
-            
+
             text = RichText(title=u"Text",
                             default_mime_type='text/structured',
                             output_mime_type='text/html')
-        
+
         class Context(PortalContent):
             implements(IWithText)
-            
+
             text = None
-        
+
         request = TestRequest()
-        
+
         widget = FieldWidget(IWithText['text'], RichTextWidget(request))
         widget.update()
-        
+
         value = widget.extract()
         self.assertEquals(NOVALUE, value)
-        
+
         request.form['%s' % widget.name] = u"Sample **text**"
         request.form['%s.mimeType' % widget.name] = 'text/structured'
-        
+
         value = widget.extract()
         self.assertEquals(u"<p>Sample <strong>text</strong></p>", value.output.strip())
-    
+
     def testWidgetConverter(self):
         from zope.interface import Interface
         from plone.app.textfield import RichText
@@ -180,11 +172,11 @@ def testWidgetConverter(self):
         _marker = object()
 
         class IWithText(Interface):
-            
+
             text = RichText(title=u"Text",
                             default_mime_type='text/structured',
                             output_mime_type='text/html',
-                            missing_value = _marker)
+                            missing_value=_marker)
 
         request = TestRequest()
 
@@ -194,7 +186,7 @@ class IWithText(Interface):
         converter = RichTextConverter(IWithText['text'], widget)
         self.assertTrue(converter.toFieldValue(u'') is _marker)
         self.assertTrue(converter.toFieldValue(RichTextValue(u'')) is _marker)
-    
+
     def testWidgetAllowedTypesDefault(self):
         from zope.interface import Interface, implements
         from plone.app.textfield import RichText
@@ -202,29 +194,29 @@ def testWidgetAllowedTypesDefault(self):
         from Products.CMFCore.PortalContent import PortalContent
         from plone.app.textfield.widget import RichTextWidget
         from z3c.form.widget import FieldWidget
-        
+
         class IWithText(Interface):
-            
+
             text = RichText(title=u"Text",
                             default_mime_type='text/structured',
                             output_mime_type='text/html')
-        
+
         class Context(PortalContent):
             implements(IWithText)
-            
+
             text = None
-        
+
         request = TestRequest()
-        
+
         widget = FieldWidget(IWithText['text'], RichTextWidget(request))
         widget.update()
-        
+
         self.portal['portal_properties']['site_properties']._setPropValue('forbidden_contenttypes', ['text/structured'])
-        
+
         allowed = widget.allowedMimeTypes()
         self.failUnless('text/html' in allowed)
         self.failIf('text/structured' in allowed)
-    
+
     def testWidgetAllowedTypesField(self):
         from zope.interface import Interface, implements
         from plone.app.textfield import RichText
@@ -232,43 +224,35 @@ def testWidgetAllowedTypesField(self):
         from Products.CMFCore.PortalContent import PortalContent
         from plone.app.textfield.widget import RichTextWidget
         from z3c.form.widget import FieldWidget
-        
+
         class IWithText(Interface):
-            
+
             text = RichText(title=u"Text",
                             default_mime_type='text/structured',
                             output_mime_type='text/html',
                             allowed_mime_types=('text/structured', 'text/html'))
-        
+
         class Context(PortalContent):
             implements(IWithText)
-            
+
             text = None
-        
+
         request = TestRequest()
-        
+
         widget = FieldWidget(IWithText['text'], RichTextWidget(request))
         widget.update()
-        
+
         self.portal['portal_properties']['site_properties']._setPropValue('forbidden_contenttypes', ['text/structured'])
-        
+
         allowed = widget.allowedMimeTypes()
         self.failUnless('text/html' in allowed)
         self.failUnless('text/structured' in allowed)
-        
-    
+
+
 def test_suite():
-    
-    field = doctest.DocFileSuite('field.txt', optionflags=doctest.ELLIPSIS)
-    field.layer = UnitTestLayer
-    
-    handler = doctest.DocFileSuite('handler.txt', optionflags=doctest.ELLIPSIS)
-    handler.layer = UnitTestLayer
-    
-    marshaler = doctest.DocFileSuite('marshaler.txt', optionflags=doctest.ELLIPSIS)
-    marshaler.layer = UnitTestLayer
-    
-    return unittest.TestSuite((
-        field, handler, marshaler,
-        unittest.makeSuite(TestIntegration),
-        ))
+    suite = unittest.makeSuite(TestIntegration)
+    for doctestfile in ['field.txt', 'handler.txt', 'marshaler.txt']:
+        suite.addTest(layered(
+            doctest.DocFileSuite(doctestfile, optionflags=doctest.ELLIPSIS),
+            layer=testing.PLONE_FIXTURE))
+    return suite
diff --git a/plone/app/textfield/transform.py b/plone/app/textfield/transform.py
index 25deaf9..ef16ce3 100644
--- a/plone/app/textfield/transform.py
+++ b/plone/app/textfield/transform.py
@@ -9,6 +9,7 @@
 
 LOG = logging.getLogger('plone.app.textfield')
 
+
 class PortalTransformsTransformer(object):
     """Invoke portal_transforms to perform a conversion
     """
@@ -52,7 +53,8 @@ def __call__(self, value, mimeType):
                 # FIXME: message not always rendered, or rendered later on other page.
                 # The following might work better, but how to get the request?
                 # IStatusMessage(request).add(msg, type='error')
-                return u'';
+                return u''
+                
             else:
                 output = data.getData()
                 return output.decode(value.encoding)
diff --git a/plone/app/textfield/utils.py b/plone/app/textfield/utils.py
index 8670ab0..e1a2172 100644
--- a/plone/app/textfield/utils.py
+++ b/plone/app/textfield/utils.py
@@ -1,34 +1,36 @@
 from zope.component.hooks import getSite
 from Products.CMFCore.utils import getToolByName
 
+
 # XXX this can probably be removed
 def getSiteEncoding(default='utf-8'):
     """Get the default site encoding
     """
     return 'utf-8'
 
+
 def getAllowedContentTypes():
     """Get a set of allowed MIME types according to the portal_properties
     tool
     """
-    
+
     site = getSite()
     if site is None:
         return None
-    
+
     portal_transforms = getToolByName(site, 'portal_transforms', None)
     if portal_transforms is None:
         return None
-    
+
     portal_properties = getToolByName(site, 'portal_properties', None)
     if portal_properties is None:
         return None
-    
+
     site_properties = portal_properties.get('site_properties', None)
     if site_properties is None:
         return None
-    
+
     allowed = set(portal_transforms.listAvailableTextInputs())
     forbidden = set(site_properties.getProperty('forbidden_contenttypes', []))
-    
+
     return allowed - forbidden
diff --git a/plone/app/textfield/value.py b/plone/app/textfield/value.py
index fbe8259..c3f0040 100644
--- a/plone/app/textfield/value.py
+++ b/plone/app/textfield/value.py
@@ -6,9 +6,9 @@
 from plone.app.textfield.interfaces import IRichTextValue, ITransformer
 from persistent import Persistent
 
-
 LOG = logging.getLogger('plone.app.textfield')
 
+
 class RawValueHolder(Persistent):
     """Place the raw value in a separate persistent object so that it does not
     get loaded when all we want is the output.
@@ -20,6 +20,7 @@ def __init__(self, value):
     def __repr__(self):
         return u"<RawValueHolder: %s>" % self.value
 
+
 class RichTextValue(object):
     """The actual value.
 
@@ -30,17 +31,15 @@ class RichTextValue(object):
     implements(IRichTextValue)
 
     def __init__(self, raw=None, mimeType=None, outputMimeType=None, encoding='utf-8', output=None):
-        self._raw_holder     = RawValueHolder(raw)
-        self._mimeType       = mimeType
+        self._raw_holder = RawValueHolder(raw)
+        self._mimeType = mimeType
         self._outputMimeType = outputMimeType
-        self._encoding       = encoding
-
+        self._encoding = encoding
     # the raw value - stored in a separate persistent object
 
     @property
     def raw(self):
         return self._raw_holder.value
-
     # Encoded raw value
 
     @property
@@ -59,7 +58,6 @@ def raw_encoded(self):
     @property
     def mimeType(self):
         return self._mimeType
-
     # the default mime type
 
     @property
diff --git a/plone/app/textfield/widget.py b/plone/app/textfield/widget.py
index 734b73a..cf3f3e9 100644
--- a/plone/app/textfield/widget.py
+++ b/plone/app/textfield/widget.py
@@ -16,22 +16,24 @@
 
 from plone.app.textfield.utils import getAllowedContentTypes
 
+
 class IRichTextWidget(ITextAreaWidget):
-    
+
     def allowedMimeTypes():
         """Get allowed MIME types
         """
 
+
 class RichTextWidget(TextAreaWidget):
     implementsOnly(IRichTextWidget)
-    
+
     klass = u'richTextWidget'
     value = None
 
     def update(self):
         super(RichTextWidget, self).update()
         addFieldClass(self)
-    
+
     def wrapped_context(self):
         context = self.context
         content = closest_content(context)
@@ -44,13 +46,13 @@ def wrapped_context(self):
         if context.__class__ == dict:
             context = UserDict(self.context)
         return ImplicitAcquisitionWrapper(context, content)
-    
+
     def extract(self, default=NOVALUE):
         raw = self.request.get(self.name, default)
-        
+
         if raw is default:
             return default
-        
+
         mimeType = self.request.get("%s.mimeType" % self.name, self.field.default_mime_type)
         return RichTextValue(raw=raw,
                              mimeType=mimeType,
@@ -63,18 +65,20 @@ def allowedMimeTypes(self):
             allowed = getAllowedContentTypes()
         return list(allowed)
 
+
 @adapter(IRichText, IFormLayer)
 @implementer(IFieldWidget)
 def RichTextFieldWidget(field, request):
     """IFieldWidget factory for RichTextWidget."""
     return FieldWidget(field, RichTextWidget(request))
 
+
 class RichTextConverter(BaseDataConverter):
     """Data converter for the RichTextWidget
     """
-    
+
     adapts(IRichText, IRichTextWidget)
-    
+
     def toWidgetValue(self, value):
         if IRichTextValue.providedBy(value):
             return value
diff --git a/setup.py b/setup.py
index 024dcdc..def5b3a 100644
--- a/setup.py
+++ b/setup.py
@@ -11,7 +11,9 @@
       # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
       classifiers=[
         "Framework :: Plone",
+        "Framework :: Plone :: 5.0",
         "Programming Language :: Python",
+        "Programming Language :: Python :: 2.7",
         "Topic :: Software Development :: Libraries :: Python Modules",
         ],
       keywords='plone schema field',
@@ -30,10 +32,6 @@
           'zope.component',
           'ZODB3 >= 3.8.1',
       ],
-      tests_require=[
-        'collective.testcaselayer',
-        'plone.supermodel [test]',
-      ],
       extras_require={
         'portaltransforms': ['Products.PortalTransforms'],
         'supermodel': ['plone.supermodel'],
@@ -41,8 +39,7 @@
         'marshaler': ['plone.rfc822'],
         'editor': ['plone.schemaeditor'],
         'tests': [
-          'Products.PloneTestCase',
-          'collective.testcaselayer',
+          'plone.app.testing',
           'plone.supermodel [test]',
         ],
       },


Repository: plone.app.textfield
Branch: refs/heads/master
Date: 2014-09-22T17:33:35+02:00
Author: Jens W. Klein (jensens) <jk at kleinundpartner.at>
Commit: https://github.com/plone/plone.app.textfield/commit/181bf319ac7571b1695e762af5c9c68c8747e3f8

Merge remote-tracking branch 'lm/master'

Files changed:
M docs/HISTORY.rst
M plone/app/textfield/widget.py

diff --git a/docs/HISTORY.rst b/docs/HISTORY.rst
index 4831d92..bd96524 100644
--- a/docs/HISTORY.rst
+++ b/docs/HISTORY.rst
@@ -4,6 +4,10 @@ Changelog
 1.2.4 (unreleased)
 ------------------
 
+* Use closest_content to navigate through the sea of subforms to
+  find something that we can use portal_url on.
+  [lentinj]
+
 - Do not give an error when the raw value is not unicode and isn't
   ascii. In that case, encode as unicode then decode as the proper
   string, bang head on desk.
diff --git a/plone/app/textfield/widget.py b/plone/app/textfield/widget.py
index bf70ba6..cf3f3e9 100644
--- a/plone/app/textfield/widget.py
+++ b/plone/app/textfield/widget.py
@@ -12,6 +12,7 @@
 
 from plone.app.textfield.interfaces import IRichText, IRichTextValue
 from plone.app.textfield.value import RichTextValue
+from plone.app.z3cform.utils import closest_content
 
 from plone.app.textfield.utils import getAllowedContentTypes
 
@@ -35,6 +36,7 @@ def update(self):
 
     def wrapped_context(self):
         context = self.context
+        content = closest_content(context)
         # We'll wrap context in the current site *if* it's not already
         # wrapped.  This allows the template to acquire tools with
         # ``context/portal_this`` if context is not wrapped already.
@@ -43,10 +45,7 @@ def wrapped_context(self):
         # short-circuiting path traversal. :-s
         if context.__class__ == dict:
             context = UserDict(self.context)
-        if context is not None and getattr(context, 'aq_inner', None) is None:
-            context = ImplicitAcquisitionWrapper(
-                context, self.form.context)
-        return context
+        return ImplicitAcquisitionWrapper(context, content)
 
     def extract(self, default=NOVALUE):
         raw = self.request.get(self.name, default)


Repository: plone.app.textfield
Branch: refs/heads/master
Date: 2014-09-22T17:35:36+02:00
Author: Jens W. Klein (jensens) <jk at kleinundpartner.at>
Commit: https://github.com/plone/plone.app.textfield/commit/94c649a768746413cea0b808886fa5e92c2c320c

unify bullets

Files changed:
M docs/HISTORY.rst

diff --git a/docs/HISTORY.rst b/docs/HISTORY.rst
index bd96524..f1dcb52 100644
--- a/docs/HISTORY.rst
+++ b/docs/HISTORY.rst
@@ -4,7 +4,7 @@ Changelog
 1.2.4 (unreleased)
 ------------------
 
-* Use closest_content to navigate through the sea of subforms to
+- Use closest_content to navigate through the sea of subforms to
   find something that we can use portal_url on.
   [lentinj]
 
@@ -12,6 +12,7 @@ Changelog
   ascii. In that case, encode as unicode then decode as the proper
   string, bang head on desk.
   [eleddy]
+
 - Internationalization.
   [thomasdesvenain]
 




-------------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CHANGES.log
Type: application/octet-stream
Size: 34392 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-testbot/attachments/20140922/387be89a/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build.log
Type: application/octet-stream
Size: 87200 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-testbot/attachments/20140922/387be89a/attachment-0003.obj>


More information about the Testbot mailing list