[Testbot] Plone 4.3 - Python 2.7 - Build # 2142 - Fixed! - 0 failure(s)

jenkins at plone.org jenkins at plone.org
Sat Apr 5 15:12:12 UTC 2014


-------------------------------------------------------------------------------
Plone 4.3 - Python 2.7 - Build # 2142 - Fixed!
-------------------------------------------------------------------------------

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


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

Repository: archetypes.referencebrowserwidget
Branch: refs/heads/master
Date: 2014-03-12T10:36:32+07:00
Author: Adam Terrey (arterrey) <arterrey at pretaweb.com>
Commit: https://github.com/plone/archetypes.referencebrowserwidget/commit/2c9c6af5783a52488ea61ddb18d3cbc145c11ad7

more compatibale checkbox check condition

Files changed:
M src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js

diff --git a/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js b/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js
index 95d8b30..ab6dea5 100644
--- a/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js
+++ b/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js
@@ -426,7 +426,7 @@ jQuery(function(jq) {
           uid_selector = "input[name='" + fieldname + ":list']",
           current = jq(uid_selector), // the widget in the form
           current_uids = current.map(function () {
-              if (jq(this).attr('checked') === true) {
+              if (jq(this).is(':checked')) {
                   return jq(this).attr('value');
               }
               return null;


Repository: archetypes.referencebrowserwidget
Branch: refs/heads/master
Date: 2014-03-12T11:19:12+07:00
Author: Adam Terrey (arterrey) <arterrey at pretaweb.com>
Commit: https://github.com/plone/archetypes.referencebrowserwidget/commit/85df846738e6d23378e2d7e40e7681d93f750087

Merge commit '1d9dcda0' into bugfix-13853-selected-items-not-checked

Files changed:
M docs/CHANGES.txt
M setup.py

diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt
index 11d00b1..440ef73 100644
--- a/docs/CHANGES.txt
+++ b/docs/CHANGES.txt
@@ -1,6 +1,12 @@
 Changelog
 =========
 
+2.4.20 (unreleased)
+-------------------
+
+- Nothing changed yet.
+
+
 2.4.19 (2013-08-13)
 -------------------
 
diff --git a/setup.py b/setup.py
index f243a76..8a39d76 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@
 def read(*rnames):
     return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
 
-version = '2.4.19'
+version = '2.4.20.dev0'
 
 long_description = (
     read('README.txt')


Repository: archetypes.referencebrowserwidget
Branch: refs/heads/master
Date: 2014-03-12T11:24:39+07:00
Author: Adam Terrey (arterrey) <arterrey at pretaweb.com>
Commit: https://github.com/plone/archetypes.referencebrowserwidget/commit/0f9ce342bdbc84a4fdd4e7271ac24922e574409d

Merge branch 'master' into bugfix-13853-selected-items-not-checked

Files changed:
M docs/CHANGES.txt
M setup.py
M src/archetypes/referencebrowserwidget/__init__.py
M src/archetypes/referencebrowserwidget/adapter.py
M src/archetypes/referencebrowserwidget/browser/popup.pt
M src/archetypes/referencebrowserwidget/browser/view.py
M src/archetypes/referencebrowserwidget/demo.py
M src/archetypes/referencebrowserwidget/interfaces.py
M src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.pt
M src/archetypes/referencebrowserwidget/tests/base.py
M src/archetypes/referencebrowserwidget/tests/test_doctests.py
M src/archetypes/referencebrowserwidget/tests/test_product.py
M src/archetypes/referencebrowserwidget/tests/test_utils.py
M src/archetypes/referencebrowserwidget/utils.py
M src/archetypes/referencebrowserwidget/widget.py

diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt
index 440ef73..9933790 100644
--- a/docs/CHANGES.txt
+++ b/docs/CHANGES.txt
@@ -1,12 +1,24 @@
 Changelog
 =========
 
-2.4.20 (unreleased)
--------------------
+2.5.1 (unreleased)
+------------------
 
 - Nothing changed yet.
 
 
+2.5.0 (2014-02-23)
+------------------
+
+- Do not use portal_interface tool but @@plone_interface_info (PLIP #13770).
+  [ale-rt]
+
+- Filter out references that are None.  This may happen when the
+  reference_catalog has links from a source to a no longer existing
+  target.
+  [maurits]
+
+
 2.4.19 (2013-08-13)
 -------------------
 
diff --git a/setup.py b/setup.py
index 8a39d76..adc9171 100644
--- a/setup.py
+++ b/setup.py
@@ -1,10 +1,11 @@
 from setuptools import setup, find_packages
 import os
 
+
 def read(*rnames):
     return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
 
-version = '2.4.20.dev0'
+version = '2.5.1.dev0'
 
 long_description = (
     read('README.txt')
@@ -33,10 +34,10 @@ def read(*rnames):
       description="A referencebrowser implementation for Archetypes",
       long_description=long_description,
       classifiers=[
-        "Framework :: Plone",
-        "Programming Language :: Python",
-        "Topic :: Software Development :: Libraries :: Python Modules",
-        ],
+          "Framework :: Plone",
+          "Programming Language :: Python",
+          "Topic :: Software Development :: Libraries :: Python Modules",
+          ],
       keywords='Relation Widget',
       author='Tom Gross',
       author_email='itconsense at gmail.com',
diff --git a/src/archetypes/referencebrowserwidget/__init__.py b/src/archetypes/referencebrowserwidget/__init__.py
index dc101cd..9dcfabc 100644
--- a/src/archetypes/referencebrowserwidget/__init__.py
+++ b/src/archetypes/referencebrowserwidget/__init__.py
@@ -4,19 +4,21 @@
 from archetypes.referencebrowserwidget.config import PROJECTNAME
 from archetypes.referencebrowserwidget.config import WITH_SAMPLE_TYPES
 from archetypes.referencebrowserwidget.widget import ReferenceBrowserWidget
-ReferenceBrowserWidget # pyflakes
+
+ReferenceBrowserWidget  # pyflakes
+
 
 def initialize(context):
     import demo
-    demo   # pyflakes
+    demo  # pyflakes
     content_types, constructors, ftis = process_types(
         listTypes(PROJECTNAME),
         PROJECTNAME)
 
     ContentInit(
         PROJECTNAME + ' Content',
-        content_types      = content_types,
-        permission         = AddPortalContent,
+        content_types = content_types,
+        permission = AddPortalContent,
         extra_constructors = constructors,
         ).initialize(context)
 
@@ -29,4 +31,3 @@ def initialize(context):
         'profiles/sample_types',
         'archetypes.referencebrowserwidget',
         EXTENSION)
-
diff --git a/src/archetypes/referencebrowserwidget/adapter.py b/src/archetypes/referencebrowserwidget/adapter.py
index 062352d..275a5bd 100644
--- a/src/archetypes/referencebrowserwidget/adapter.py
+++ b/src/archetypes/referencebrowserwidget/adapter.py
@@ -1,13 +1,16 @@
-
 def ATReferenceAdapter(context, field):
     relationship = field.relationship
-    return [item.getTargetObject()
-            for item in context.getReferenceImpl(relationship)]
+    items = [item.getTargetObject()
+             for item in context.getReferenceImpl(relationship)]
+    return [item for item in items if item is not None]
+
 
 def ATBackReferenceAdapter(context, field):
     relationship = field.relationship
-    return [item.getTargetObject()
-            for item in context.getBackReferenceImpl(relationship)]
+    items = [item.getTargetObject()
+             for item in context.getBackReferenceImpl(relationship)]
+    return [item for item in items if item is not None]
+
 
 def PloneRelationsAdapter(context, field):
     relationship = field.relationship
@@ -19,4 +22,3 @@ def PloneRelationsRevAdapter(context, field):
     relationship = field.relationship
     from plone.app.relations.interfaces import IRelationshipTarget
     return IRelationshipTarget(context).getSources(relation=relationship)
-
diff --git a/src/archetypes/referencebrowserwidget/browser/popup.pt b/src/archetypes/referencebrowserwidget/browser/popup.pt
index 9e2a057..c7cae56 100644
--- a/src/archetypes/referencebrowserwidget/browser/popup.pt
+++ b/src/archetypes/referencebrowserwidget/browser/popup.pt
@@ -187,7 +187,7 @@
 
         <td>
           <tal:referenceable tal:condition="referenceable">
-            <input type="checkbox" class="insertreference" tal:attributes="rel uid; id uid" />
+            <input type="checkbox" class="insertreference" tal:attributes="id uid; rel uid" />
           </tal:referenceable>
         </td>
 
diff --git a/src/archetypes/referencebrowserwidget/browser/view.py b/src/archetypes/referencebrowserwidget/browser/view.py
index 2a5fabd..146e784 100644
--- a/src/archetypes/referencebrowserwidget/browser/view.py
+++ b/src/archetypes/referencebrowserwidget/browser/view.py
@@ -45,6 +45,7 @@
 
 PMF = MessageFactory('plone')
 
+
 class ReferenceBrowserHelperView(BrowserView):
     """ A helper view for the reference browser widget.
 
@@ -62,15 +63,17 @@ def getFieldRelations(self, field, value=None):
             is supported it needs to be a list of UIDs.
         """
         if not value:
-            return queryMultiAdapter((self.context, field),
-                                     interface=IFieldRelation, default=[])
+            items = queryMultiAdapter((self.context, field),
+                                      interface=IFieldRelation, default=[])
+            return [item for item in items if item is not None]
         else:
             if isinstance(value, basestring):
                 value = [value]
             if type(value) != ListType and type(value) != TupleType:
                 return []
             catalog = getToolByName(aq_inner(self.context), REFERENCE_CATALOG)
-            return [catalog.lookupObject(uid) for uid in value if uid]
+            items = [catalog.lookupObject(uid) for uid in value if uid]
+            return [item for item in items if item is not None]
 
     def getUidFromReference(self, ref):
         """ Helper to get UID in restricted code without having rights to
@@ -266,9 +269,9 @@ def getResult(self):
         qc = getMultiAdapter((self.context, self.request),
                              name='refbrowser_querycatalog')
         if self.widget.show_results_without_query or self.search_text:
-            result = (self.widget.show_results_without_query or \
-                      self.search_text) and \
-                      qc(search_catalog=self.widget.search_catalog)
+            result = (self.widget.show_results_without_query or
+                self.search_text) and \
+                qc(search_catalog=self.widget.search_catalog)
 
             self.has_queryresults = bool(result)
 
@@ -277,8 +280,8 @@ def getResult(self):
                                         name="plone")
             folder = ploneview.getCurrentFolder()
             self.request.form['path'] = {
-                              'query': '/'.join(folder.getPhysicalPath()),
-                              'depth':1}
+                'query': '/'.join(folder.getPhysicalPath()),
+                'depth': 1}
             self.request.form['portal_type'] = []
             if 'sort_on' in self.widget.base_query:
                 self.request.form['sort_on'] = self.widget.base_query['sort_on']
@@ -304,15 +307,15 @@ def breadcrumbs(self, startup_directory=None):
         if not self.widget.restrict_browsing_to_startup_directory:
             newcrumbs = [{'Title': PMF('Home'),
                           'absolute_url': self.genRefBrowserUrl(
-                                portal_state.navigation_root_url())}]
+                              portal_state.navigation_root_url())}]
         else:
             # display only crumbs into startup directory
             startup_dir_url = startup_directory or \
                 utils.getStartupDirectory(context,
                         self.widget.getStartupDirectory(context, self.field))
             newcrumbs = []
-            crumbs = [c for c in crumbs \
-                             if c['absolute_url'].startswith(startup_dir_url)]
+            crumbs = [c for c in crumbs
+                      if c['absolute_url'].startswith(startup_dir_url)]
 
         for c in crumbs:
             c['absolute_url'] = self.genRefBrowserUrl(c['absolute_url'])
@@ -323,7 +326,7 @@ def breadcrumbs(self, startup_directory=None):
     def genRefBrowserUrl(self, urlbase):
         assert self._updated
         return "%s/%s?fieldName=%s&fieldRealName=%s&at_url=%s" % (
-       urlbase, self.__name__, self.fieldName, self.fieldRealName, self.at_url)
+            urlbase, self.__name__, self.fieldName, self.fieldRealName, self.at_url)
 
     def getUid(self, item):
         assert self._updated
@@ -340,7 +343,7 @@ def safe_get_object(item):
                 return None
 
         return self.has_brain and self.getUid(item) != self.brainuid or \
-               safe_get_object(item) != self.at_obj
+            safe_get_object(item) != self.at_obj
 
     def isReferencable(self, item):
         assert self._updated
@@ -352,7 +355,7 @@ def isReferencable(self, item):
             review_state_allows = item.review_state in \
                 (self.widget.only_for_review_states or ())
         return self.getUid(item) and item_referenceable and \
-               review_state_allows and self.isNotSelf(item)
+            review_state_allows and self.isNotSelf(item)
 
     def isBrowsable(self, item):
         if not self.browsable_types:
diff --git a/src/archetypes/referencebrowserwidget/demo.py b/src/archetypes/referencebrowserwidget/demo.py
index bc493ff..801223e 100644
--- a/src/archetypes/referencebrowserwidget/demo.py
+++ b/src/archetypes/referencebrowserwidget/demo.py
@@ -10,11 +10,11 @@
 from archetypes.referencebrowserwidget.config import PROJECTNAME
 from archetypes.referencebrowserwidget.widget import ReferenceBrowserWidget
 
-schema = BaseSchema.copy() +  Schema((
+schema = BaseSchema.copy() + Schema((
 
     ReferenceField('singleRef',
         multiValued=0,
-        allowed_types=('Document','File', 'RefBrowserDemo'),
+        allowed_types=('Document', 'File', 'RefBrowserDemo'),
         relationship='Rel1',
         widget=ReferenceBrowserWidget(
             default_search_index='SearchableText',
@@ -41,7 +41,7 @@
             allow_browse=0,
             force_close_on_insert=1,
             show_indexes=1,
-            available_indexes={'SearchableText':'Free text search',
+            available_indexes={'SearchableText': 'Free text search',
                                'Description': "Object's description"},
             description='And here is another field.  Available indexes are "SearchableText" and "Description"')),
 
@@ -62,7 +62,7 @@
             allow_browse=0,
             description=('And here is another field with a fixed query '
                          'restriction (only published objects will appear).'),
-            base_query={'review_state':'published'})),
+            base_query={'review_state': 'published'})),
 
     ReferenceField('multiRef5',
         multiValued=1,
@@ -78,6 +78,7 @@
             popup_height=209))
      ))
 
+
 class RefBrowserDemo(BaseContent):
     """
     Demo from archetypes.referencebrowserwidget
@@ -90,8 +91,8 @@ def dynamicBaseQuery(self):
              only objects whose start property is within one week of the
              current day
         """
-        current_week = [DateTime()-7,DateTime()+7]
-        return {'start': {'query':current_week, 'range':'minmax'}}
+        current_week = [DateTime()-7, DateTime()+7]
+        return {'start': {'query': current_week, 'range': 'minmax'}}
 
     def dynamicDirectory(self):
         return '/bar/dynamic'
diff --git a/src/archetypes/referencebrowserwidget/interfaces.py b/src/archetypes/referencebrowserwidget/interfaces.py
index ddd4fe6..d01a22f 100644
--- a/src/archetypes/referencebrowserwidget/interfaces.py
+++ b/src/archetypes/referencebrowserwidget/interfaces.py
@@ -1,7 +1,7 @@
-
 from zope.interface import Interface
 from Products.Archetypes.interfaces import IObjectField
 
+
 class IFieldRelation(Interface):
     """ """
 
@@ -9,6 +9,7 @@ class IFieldRelation(Interface):
 class IATReferenceField(IObjectField):
     """ Missing marker for Products.Archetypes.Field.ReferenceField """
 
+
 class IATBackRefereneceField(IObjectField):
     """ Missing marker for Products.ATBackRef.BackReferenceField """
 
@@ -16,27 +17,28 @@ class IATBackRefereneceField(IObjectField):
 class IPloneRelationsRefField(IObjectField):
     """ Missing marker for plone.relations.PloneRelationsATField """
 
+
 class IPloneRelationsRevRefField(IObjectField):
     """ Missing marker for plone.relations.ReversePloneRelationsATField """
 
 
 class IReferenceBrowserHelperView(Interface):
 
-      def getFieldRelations(field, value):
-          """ """
+    def getFieldRelations(field, value):
+        """ """
 
-      def getStartupDirectory(field):
-          """ """
+    def getStartupDirectory(field):
+        """ """
 
-      def getUidFromReference(ref):
-          """ Get UID in restricted code
+    def getUidFromReference(ref):
+        """ Get UID in restricted code
 
-              Can be used in restricted code without having rights to
-              access the object.
-          """
+            Can be used in restricted code without having rights to
+            access the object.
+        """
 
-      def getPortalPath():
-          """ Return the path to the portal """
+    def getPortalPath():
+        """ Return the path to the portal """
 
-      def canView(obj):
-          """ Check, if the logged in user has the view permission on `obj` """
+    def canView(obj):
+        """ Check, if the logged in user has the view permission on `obj` """
diff --git a/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.pt b/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.pt
index 14b4526..2868aac 100644
--- a/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.pt
+++ b/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.pt
@@ -22,10 +22,11 @@
           condition="refs">
 
 
-        <tal:notMultivalued condition="not:field/multiValued"> 
+        <tal:notMultivalued condition="not:field/multiValued">
         <tal:block condition="python: (can_view or not hide_inaccessible)"
                    define="obj python:refs[0];
                            obj_path python: '/'.join(obj.getPhysicalPath());
+                           obj_interface_info nocall:obj/@@plone_interface_info
                            can_view python: helper.canView(obj)">
           <img src="#" alt="Image"
               tal:condition="python: obj.portal_type in image_portal_types"
@@ -39,8 +40,7 @@
               >Sole target object's title</a>
 
             <a href="#"
-               tal:condition="python:portal.portal_interface.objectImplements(obj,
-                        'Products.Archetypes.interfaces.referenceengine.IContentReference')"
+               tal:condition="python:obj_interface_info.provides('Products.Archetypes.interfaces.referenceengine.IContentReference')"
                tal:attributes="href python:ref.getContentObject().absolute_url();
                                class python:obj.portal_type.replace(' ', '_')"
                tal:content="field/relationship"
@@ -53,12 +53,13 @@
             </tal:if>
 
         </tal:block>
-        </tal:notMultivalued> 
+        </tal:notMultivalued>
 
         <ul tal:condition="field/multiValued">
           <tal:block tal:repeat="obj refs">
             <tal:block define="obj_path python: '/'.join(obj.getPhysicalPath());
-                               can_view python: helper.canView(obj)"
+                               can_view python: helper.canView(obj);
+                               obj_interface_info nocall:obj/@@plone_interface_info"
                        condition="python: can_view or not hide_inaccessible">
               <li>
                 <img tal:condition="python:obj.portal_type in image_portal_types"
@@ -72,8 +73,7 @@
                     >Target Title</a>
 
                 <a href="#"
-                    tal:condition="python:portal.portal_interface.objectImplements(obj,
-                        'Products.Archetypes.interfaces.referenceengine.IContentReference')"
+                    tal:condition="python:obj_interface_info.provides('Products.Archetypes.interfaces.referenceengine.IContentReference')"
                     tal:attributes="href python:ref.getContentObject().absolute_url();
                                     class python:obj.portal_type.replace(' ', '_')"
                     tal:content="field/relationship"
diff --git a/src/archetypes/referencebrowserwidget/tests/base.py b/src/archetypes/referencebrowserwidget/tests/base.py
index 0d05b4f..3e43a51 100644
--- a/src/archetypes/referencebrowserwidget/tests/base.py
+++ b/src/archetypes/referencebrowserwidget/tests/base.py
@@ -22,6 +22,7 @@
 ztc.utils.setupCoreSessions(app)
 ztc.close(app)
 
+
 @onsetup
 def setup_sample_types():
     # setup sample types
@@ -45,6 +46,7 @@ def setup_sample_types():
 
 import archetypes.referencebrowserwidget
 
+
 class MixIn(object):
     """ Mixin for setting up the necessary bits for testing the
         archetypes.referencebrowserwidget
@@ -83,11 +85,13 @@ def removeDefaultStructure(self):
 class TestCase(MixIn, ptc.PloneTestCase):
     """ Base TestCase for archetypes.referencebrowserwidget """
 
+
 class FunctionalTestCase(MixIn, ptc.FunctionalTestCase):
     """ Base FunctionalTestCase for archetypes.referencebrowserwidget """
 
     basic_auth = '%s:%s' % (default_user, default_password)
 
+
 class DummySession(dict):
 
     def set(self, key, value):
@@ -102,6 +106,7 @@ def __init__(self, location):
     def getPhysicalPath(self):
         return self.location.split('/')
 
+
 class PopupBaseTestCase(TestCase):
 
     def afterSetUp(self):
@@ -125,6 +130,7 @@ def _getPopup(self, obj=None, request=None):
         popup.update()
         return popup
 
+
 def normalize(s):
     """ Helper method for integration tests """
     return ' '.join(s.split())
diff --git a/src/archetypes/referencebrowserwidget/tests/test_doctests.py b/src/archetypes/referencebrowserwidget/tests/test_doctests.py
index b4371f6..290da8e 100644
--- a/src/archetypes/referencebrowserwidget/tests/test_doctests.py
+++ b/src/archetypes/referencebrowserwidget/tests/test_doctests.py
@@ -1,4 +1,6 @@
-import unittest, doctest
+import doctest
+import unittest
+
 
 def test_suite():
     suite = unittest.TestSuite()
@@ -6,4 +8,3 @@ def test_suite():
             'archetypes.referencebrowserwidget.utils',
             ))
     return suite
-
diff --git a/src/archetypes/referencebrowserwidget/tests/test_product.py b/src/archetypes/referencebrowserwidget/tests/test_product.py
index 05bc923..f7f7d71 100644
--- a/src/archetypes/referencebrowserwidget/tests/test_product.py
+++ b/src/archetypes/referencebrowserwidget/tests/test_product.py
@@ -49,6 +49,7 @@
 
 _marker = []
 
+
 class ProductsTestCase(TestCase):
     """ Basic product unit tests """
 
@@ -99,7 +100,7 @@ def test_requiredbehavior_multi(self):
         form = {'singleRef': '',
                 'multiRef2': ['']}
         value = field.widget.process_form(context, field, form,
-                                           empty_marker=_marker)
+                                          empty_marker=_marker)
         assert value is _marker
 
         # without value
@@ -107,7 +108,7 @@ def test_requiredbehavior_multi(self):
                 'multiRef2': [''],
                 'multiRef': []}
         value = field.widget.process_form(context, field, form,
-                                           empty_marker=_marker)
+                                          empty_marker=_marker)
         assert len(value) == 2
         assert value[0] == []
         assert value[0] is not _marker
@@ -145,7 +146,7 @@ def test_requiredbehavior_single(self):
         # without key
         form = {'multiRef2': ['']}
         value = field.widget.process_form(context, field, form,
-                                           empty_marker=_marker)
+                                          empty_marker=_marker)
         assert value is _marker
 
         # without value
@@ -153,7 +154,7 @@ def test_requiredbehavior_single(self):
                 'multiRef2': [''],
                 'multiRef': []}
         value = field.widget.process_form(context, field, form,
-                                           empty_marker=_marker)
+                                          empty_marker=_marker)
         assert len(value) == 2
         assert value[0] == ''
 
@@ -164,10 +165,12 @@ def test_requiredbehavior_single(self):
                                           empty_marker=_marker)
         assert value is _marker
 
+
 def getPTName(filename):
     basepath, ext = os.path.splitext(filename)
     return os.path.basename(basepath)
 
+
 class PopupTestCase(PopupBaseTestCase):
     """ Test the popup view """
 
@@ -417,8 +420,8 @@ def test_isNotSelf(self):
         copybrain = catalog(id='copy_of_ref')[0]
 
         popup = self._getPopup()
-        assert popup.isNotSelf(copybrain) == True
-        assert popup.isNotSelf(refbrain) == False
+        assert popup.isNotSelf(copybrain) is True
+        assert popup.isNotSelf(refbrain) is False
 
 
 class HelperViewTestCase(TestCase):
@@ -549,7 +552,7 @@ class DummyRef(object):
             def UID(self):
                 return _marker
         helper = ReferenceBrowserHelperView(DummyObject('/plone/foo'), TestRequest())
-        self.failUnless(helper.getUidFromReference(DummyRef()) is _marker)
+        self.assertTrue(helper.getUidFromReference(DummyRef()) is _marker)
 
     def test_canview(self):
         makeContent(self.folder, portal_type='Document', id='doc1')
@@ -559,6 +562,7 @@ def test_canview(self):
         self.logout()
         self.assertFalse(helper.canView(self.folder.doc1))
 
+
 class IntegrationTestCase(FunctionalTestCase):
     """ Browser/publish tests of referencebrowser widget
     """
@@ -601,22 +605,23 @@ def test_multivalued(self):
 
     def test_basewidget(self):
         response = self.publish('%s/base_edit' % self.demo1_url,
-                                                 self.basic_auth)
+                                self.basic_auth)
         body = normalize(response.getBody())
         assert ('<script type="text/javascript" charset="iso-8859-1" '
                 'src="http://nohost/plone/referencebrowser.js"> '
                 '</script>') in body
 
+        # Check the div.  Allow for the existence of extra classes and
+        # extra data attributes.
         widgetdiv = re.compile((
-            r'<div class="field ArchetypesReferenceBrowserWidget .*?" '
-             'id="archetypes-fieldname-singleRef">'))
+            r'<div class="field ArchetypesReferenceBrowserWidget [^"]*"[^>]*'
+            'id="archetypes-fieldname-singleRef"'))
         assert widgetdiv.search(body)
         assert (
             '<input id="ref_browser_singleRef_label" size="50" type="text" readonly="readonly" '
             'value="No reference set. Click the add button to select." /> '
             ) in body
-        assert ('<input type="hidden" name="singleRef" id="ref_browser_singleRef" /> ') \
-                in body
+        assert ('<input type="hidden" name="singleRef" id="ref_browser_singleRef" /> ') in body
         assert ('<input type="button" class="searchButton addreference" '
                 'value="Add..." src="') in body
         assert '''<input type="button" class="destructive" value="Clear reference" onclick="javascript:refbrowser_removeReference('ref_browser_singleRef', 0)" />''' in body
@@ -630,7 +635,7 @@ def getNormalizedPopup(self, url=None, field=None, startup_path=None):
             startup_path = self.popup_url
         response = self.publish(
             '%s?fieldName=%s&fieldRealName=%s&at_url=%s'
-          % (startup_path, field, field, url), self.basic_auth)
+            % (startup_path, field, field, url), self.basic_auth)
 
         return normalize(response.getBody())
 
@@ -679,9 +684,9 @@ def test_bc_navigationroot(self):
 
         browser = Browser()
         data = {
-          'fieldName': 'relatedItems',
-          'fieldRealName': 'relatedItems',
-          'at_url': page.absolute_url(1)}
+            'fieldName': 'relatedItems',
+            'fieldRealName': 'relatedItems',
+            'at_url': page.absolute_url(1)}
 
         basic = '%s:%s' % (portal_owner, default_password)
 
@@ -692,7 +697,7 @@ def test_bc_navigationroot(self):
                          'fieldName=relatedItems&fieldRealName=relatedItems'
                          '&at_url=plone/folder1/page1" rel="Home"> '
                          '<span>Home</span> </a>')
-                         in normalize(browser.contents))
+                        in normalize(browser.contents))
 
         # now let's change the navigation root
         zope.interface.alsoProvides(self.portal.folder1, INavigationRoot)
@@ -702,7 +707,7 @@ def test_bc_navigationroot(self):
                          'fieldName=relatedItems&fieldRealName=relatedItems'
                          '&at_url=plone/folder1/page1" rel="Home"> '
                          '<span>Home</span> </a>')
-                         in normalize(browser.contents))
+                        in normalize(browser.contents))
 
     def test_startup_directory(self):
         startup_path = self.portal.folder1.absolute_url(1)
@@ -710,14 +715,14 @@ def test_startup_directory(self):
                                        field='multiRef3')
         self.assertTrue(
             ('<div id="portal-breadcrumbs"> '
-               '<span id="breadcrumbs-you-are-here">You are here:</span> '
-               '<span id="breadcrumbs-home"> '
-                 '<a href="http://nohost/plone">Home</a> '
-                   '<span class="breadcrumbSeparator"> / </span> '
-               '</span> '
-               '<span id="breadcrumbs-1" dir="ltr"> '
-                 '<span id="breadcrumbs-current">folder1</span> '
-               '</span> '
+             '<span id="breadcrumbs-you-are-here">You are here:</span> '
+             '<span id="breadcrumbs-home"> '
+             '<a href="http://nohost/plone">Home</a> '
+             '<span class="breadcrumbSeparator"> / </span> '
+             '</span> '
+             '<span id="breadcrumbs-1" dir="ltr"> '
+             '<span id="breadcrumbs-current">folder1</span> '
+             '</span> '
              '</div>') in body)
 
 
diff --git a/src/archetypes/referencebrowserwidget/tests/test_utils.py b/src/archetypes/referencebrowserwidget/tests/test_utils.py
index d2dbe35..b76b437 100644
--- a/src/archetypes/referencebrowserwidget/tests/test_utils.py
+++ b/src/archetypes/referencebrowserwidget/tests/test_utils.py
@@ -9,7 +9,7 @@ class UtilsTestCase(unittest.TestCase):
 
     def test_emptyquotequery(self):
         assert utils.quotequery('') == ''
-        assert utils.quotequery(None) == None
+        assert utils.quotequery(None) is None
 
     def test_quotequery(self):
         assert utils.quotequery('foo and bar') == 'foo and bar'
@@ -62,4 +62,3 @@ def test_relstartupdir(self):
 
 def test_suite():
     return unittest.defaultTestLoader.loadTestsFromName(__name__)
-
diff --git a/src/archetypes/referencebrowserwidget/utils.py b/src/archetypes/referencebrowserwidget/utils.py
index f8269b0..e05c823 100644
--- a/src/archetypes/referencebrowserwidget/utils.py
+++ b/src/archetypes/referencebrowserwidget/utils.py
@@ -150,7 +150,7 @@ def quotequery(s):
 
     for idx in range(1, len(terms)):
         if (terms[idx].upper() in s_tokens and
-            terms[idx-1].upper() in tokens):
+                terms[idx-1].upper() in tokens):
             terms[idx] = quotestring(terms[idx])
 
     return ' '.join(terms)
@@ -166,5 +166,3 @@ def getSearchCatalog(context, name=''):
         catalog = portal_catalog
 
     return catalog
-
-
diff --git a/src/archetypes/referencebrowserwidget/widget.py b/src/archetypes/referencebrowserwidget/widget.py
index d9b2c56..8907231 100644
--- a/src/archetypes/referencebrowserwidget/widget.py
+++ b/src/archetypes/referencebrowserwidget/widget.py
@@ -4,7 +4,7 @@
 from AccessControl import ClassSecurityInfo
 
 from Products.Archetypes.utils import shasattr
-from Products.Archetypes.Registry import registerWidget,registerPropertyType
+from Products.Archetypes.Registry import registerWidget, registerPropertyType
 from Products.Archetypes.Widget import ReferenceWidget
 
 
@@ -86,7 +86,7 @@ def getBaseQuery(self, instance, field):
                 results = method()
             elif callable(query):
                 results = query()
-            elif isinstance(query,dict):
+            elif isinstance(query, dict):
                 results = query
             else:
                 raise ValueError("Wrong format for reference widget base_query parameter")
@@ -106,14 +106,14 @@ def getBaseQuery(self, instance, field):
         # Add portal type restrictions based on settings in field, if not part
         # of original base_query the template tries to do this, but ignores
         # allowed_types_method, which should override allowed_types
-        if not results.has_key('portal_type'):
+        if 'portal_type' not in results:
             allowed_types = getattr(field, 'allowed_types', ())
             allow_method = getattr(field, 'allowed_types_method', None)
             if allow_method is not None:
                 meth = getattr(instance, allow_method)
                 allowed_types = meth()
 
-            results['portal_type'] = allowed_types# + self.browsable_types
+            results['portal_type'] = allowed_types  # + self.browsable_types
 
         return results
 
@@ -130,7 +130,7 @@ def process_form(self, instance, field, form, empty_marker=None,
         # to trigger the isempty-validator and not use the previous content of
         # the field.
         if field.required and field.multiValued and \
-           not emptyReturnsMarker and result == ([''], {}):
+                not emptyReturnsMarker and result == ([''], {}):
             return [], {}
 
         return result


Repository: archetypes.referencebrowserwidget
Branch: refs/heads/master
Date: 2014-03-25T14:25:29+07:00
Author: Adam Terrey (arterrey) <arterrey at pretaweb.com>
Commit: https://github.com/plone/archetypes.referencebrowserwidget/commit/bfc5cb398993e8b0de5c95bcea0768d57b84e917

Updated CHANGES.txt

Files changed:
M docs/CHANGES.txt

diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt
index 9933790..6b7cdca 100644
--- a/docs/CHANGES.txt
+++ b/docs/CHANGES.txt
@@ -4,7 +4,9 @@ Changelog
 2.5.1 (unreleased)
 ------------------
 
-- Nothing changed yet.
+- Use foward compatable test for checked items with jQuery >=1.7 
+  fixes https://dev.plone.org/ticket/13853
+  [arterrey]
 
 
 2.5.0 (2014-02-23)


Repository: archetypes.referencebrowserwidget
Branch: refs/heads/master
Date: 2014-04-02T10:33:37+02:00
Author: Gauthier Bastien (gbastien) <g.bastien at imio.be>
Commit: https://github.com/plone/archetypes.referencebrowserwidget/commit/c8e3a5b6139961de6de60fef1554f716327f3f5d

Update referencebrowser.js

Updated to use === comparison...

Files changed:
M src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js

diff --git a/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js b/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js
index ab6dea5..84cab78 100644
--- a/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js
+++ b/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js
@@ -426,7 +426,7 @@ jQuery(function(jq) {
           uid_selector = "input[name='" + fieldname + ":list']",
           current = jq(uid_selector), // the widget in the form
           current_uids = current.map(function () {
-              if (jq(this).is(':checked')) {
+              if (this.checked === true) {
                   return jq(this).attr('value');
               }
               return null;


Repository: archetypes.referencebrowserwidget
Branch: refs/heads/master
Date: 2014-04-05T10:05:42-04:00
Author: Eric Steele (esteele) <eric at esteele.net>
Commit: https://github.com/plone/archetypes.referencebrowserwidget/commit/ff5f69350f21666577c0a9a617581958271fb03e

Merge pull request #15 from plone/bugfix-13853-selected-items-not-checked

Bugfix 13853 selected items not checked

Files changed:
M docs/CHANGES.txt
M src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js

diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt
index 9933790..6b7cdca 100644
--- a/docs/CHANGES.txt
+++ b/docs/CHANGES.txt
@@ -4,7 +4,9 @@ Changelog
 2.5.1 (unreleased)
 ------------------
 
-- Nothing changed yet.
+- Use foward compatable test for checked items with jQuery >=1.7 
+  fixes https://dev.plone.org/ticket/13853
+  [arterrey]
 
 
 2.5.0 (2014-02-23)
diff --git a/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js b/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js
index 95d8b30..84cab78 100644
--- a/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js
+++ b/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js
@@ -426,7 +426,7 @@ jQuery(function(jq) {
           uid_selector = "input[name='" + fieldname + ":list']",
           current = jq(uid_selector), // the widget in the form
           current_uids = current.map(function () {
-              if (jq(this).attr('checked') === true) {
+              if (this.checked === true) {
                   return jq(this).attr('value');
               }
               return null;




-------------------------------------------------------------------------------


More information about the Testbot mailing list