Lineage.themeselection on Plone 5.2.x, Python 3

@jensens @thet do you think it is doable to update lineage.themeselection and lineage.registry to work on Plone 5.2.x and Python 3? I am trying to figure out lineage.registry; when I run the tests on Plone 5.2.1 and Python 3, I get 4 tests passing and 1 failure.

If you have any pointers or warnings, please let me know :laughing:

When I was trying to use bin/instance debug to see if a child site got its own registry, it seemed inconclusive. See farther below

 $ bin/test -s lineage.registry
/Users/kimnguyen/src/myaddoneggs/plone.app.event-3.2.6-py3.7.egg/plone/app/event/__init__.py:2: DeprecationWarning: setDefaultRoles is deprecated. Please use addPermission from AccessControl.Permission.
  from Products.CMFCore.permissions import setDefaultRoles
/Users/kimnguyen/src/myaddoneggs/robotframework-3.1.2-py3.7.egg/robot/utils/robottypes3.py:16: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
  from collections import Mapping, UserString
/Users/kimnguyen/src/myaddoneggs/robotframework-3.1.2-py3.7.egg/robot/utils/normalizing.py:16: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
  from collections import MutableMapping
/Users/kimnguyen/src/myaddoneggs/plone.app.event-3.2.6-py3.7.egg/plone/app/event/testing.py:132: DeprecationWarning: ZSERVER_FIXTURE is deprecated. Please import from plone.testing.zope.
  z2.ZSERVER_FIXTURE,
/Users/kimnguyen/src/myaddoneggs/plone.api-1.10.0-py3.7.egg/plone/api/validation.py:15: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
  signature_args, _, _, _ = inspect.getargspec(func)
Test-module import failures:

Module: lineage.registry.src.lineage.registry.tests

ModuleNotFoundError: No module named 'lineage.registry.src'


Running myaddon.testing.myaddonLayer:IntegrationTesting tests:
  Set up plone.testing.zca.LayerCleanup in 0.000 seconds.
  Set up plone.testing.zope.Startup in 0.314 seconds.
  Set up plone.app.testing.layers.PloneFixture /Users/kimnguyen/src/myaddoneggs/Products.CMFFormController-4.1.0-py3.7.egg/Products/CMFFormController/FormAction.py:6: DeprecationWarning: InitializeClass is deprecated. Please import from AccessControl.class_init.
  from App.class_init import InitializeClass
/Users/kimnguyen/src/myaddoneggs/Products.CMFFormController-4.1.0-py3.7.egg/Products/CMFFormController/ControllerPythonScript.py:41: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp
/Users/kimnguyen/src/myaddoneggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py:240: DeprecationWarning: IObjectEvent is deprecated. Import from zope.interface.interfaces
  obj = getattr(mod, oname)
/Users/kimnguyen/src/myaddoneggs/plone.app.textfield-1.3.2-py3.7.egg/plone/app/textfield/utils.py:10: DeprecationWarning: ComponentLookupError is deprecated. Import from zope.interface.interfaces
  from zope.component.interfaces import ComponentLookupError
/Users/kimnguyen/src/myaddoneggs/plone.app.content-3.7.4-py3.7.egg/plone/app/content/browser/vocabulary.py:10: DeprecationWarning: IFieldPermissionChecker is deprecated. Import IFieldPermissionChecker from plone.app.z3cform.interfaces instead
  from plone.app.widgets.interfaces import IFieldPermissionChecker
/Users/kimnguyen/src/myaddoneggs/plone.stringinterp-1.3.1-py3.7.egg/plone/stringinterp/adapters.py:13: DeprecationWarning: zope.site.hooks has moved to zope.component.hooks. Import of zope.site.hooks will become unsupported in Version 5.0
  from zope.site.hooks import getSite
/Users/kimnguyen/src/myaddoneggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py:240: DeprecationWarning: IComponentRegistry is deprecated. Import from zope.interface.interfaces
  obj = getattr(mod, oname)
/Users/kimnguyen/src/myaddoneggs/plone.schemaeditor-2.1.0-py3.7.egg/plone/schemaeditor/utils.py:6: DeprecationWarning: ObjectEvent is deprecated. Import from zope.interface.interfaces
  from zope.component.interfaces import ObjectEvent
/Users/kimnguyen/src/myaddoneggs/plone.app.layout-3.4.0-py3.7.egg/plone/app/layout/viewlets/common.py:19: DeprecationWarning: ILanguageSchema is deprecated. It has been moved to plone.i18n.interfaces, import from there instead.
  from Products.CMFPlone.interfaces.controlpanel import ILanguageSchema
/Users/kimnguyen/src/myaddoneggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py:240: DeprecationWarning: LazyMap is deprecated. Please import from ZTUtils.Lazy.
  obj = getattr(mod, oname)
/Users/kimnguyen/src/myaddoneggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py:240: DeprecationWarning: LazyCat is deprecated. Please import from ZTUtils.Lazy.
  obj = getattr(mod, oname)
/Users/kimnguyen/src/myaddoneggs/plone.app.layout-3.4.0-py3.7.egg/plone/app/layout/globals/portal.py:11: DeprecationWarning: ILanguageSchema is deprecated. It has been moved to plone.i18n.interfaces, import from there instead.
  from Products.CMFPlone.interfaces import ILanguageSchema
/Users/kimnguyen/src/myaddoneggs/calmjs.parse-1.2.1-py3.7.egg/calmjs/parse/io.py:7: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
  from collections import Iterable
/Users/kimnguyen/src/myaddoneggs/pyScss-1.3.5-py3.7.egg/scss/namespace.py:172: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
  argspec = inspect.getargspec(function)
/Users/kimnguyen/src/myaddoneggs/pyScss-1.3.5-py3.7.egg/scss/selector.py:54: FutureWarning: Possible nested set at position 329
  ''', re.VERBOSE | re.MULTILINE)
/Users/kimnguyen/src/myaddoneggs/plone.protect-4.1.3-py3.7.egg/plone/protect/utils.py:48: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
  spec = inspect.getargspec(callable)
Could not install product Products.ResourceRegistries
/Users/kimnguyen/src/myaddoneggs/Products.CMFPlone-5.2.1-py3.7.egg/Products/CMFPlone/resources/browser/combine.py:53: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
  logger.warn(u'Could not find resource {0}. You may have to create it first.'.format(path))  # noqa
/Users/kimnguyen/src/myaddoneggs/plone.resource-2.1.1-py3.7.egg/plone/resource/manifest.py:82: DeprecationWarning: The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.
  parser = SafeConfigParser()
in 9.503 seconds.
  Set up plone.app.event.testing.PAEventLayer /Users/kimnguyen/src/myaddoneggs/plone.app.event-3.2.6-py3.7.egg/plone/app/event/testing.py:72: DeprecationWarning: installProduct is deprecated. Please import from plone.testing.zope.
  z2.installProduct(app, 'Products.DateRecurringIndex')
in 0.253 seconds.
  Set up plone.app.contenttypes.testing.PloneAppContenttypes in 0.156 seconds.
  Set up myaddon.testing.myaddonLayer /Users/kimnguyen/src/myaddoneggs/plone.restapi-6.1.0-py3.7.egg/plone/restapi/serializer/catalog.py:5: DeprecationWarning: Lazy is deprecated. Please import from ZTUtils.Lazy.
  from Products.ZCatalog.Lazy import Lazy
/Users/kimnguyen/src/myaddoneggs/plone.app.standardtiles-2.3.2-py3.7.egg/plone/app/standardtiles/navigation.py:5: DeprecationWarning: isDefaultPage is deprecated. Import from Products.CMFPlone instead
  from plone.app.layout.navigation.defaultpage import isDefaultPage
/Users/kimnguyen/src/myaddoneggs/Products.CMFDynamicViewFTI-6.0.2-py3.7.egg/Products/CMFDynamicViewFTI/interface.py:9: DeprecationWarning: import from Products.CMFDynamicViewFTI.interfaces instead
  DeprecationWarning
/Users/kimnguyen/src/myaddoneggs/plone.jsonserializer-0.9.7-py3.7.egg/plone/jsonserializer/serializer/converters.py:37: DeprecationWarning: getSiteEncoding: `getSiteEncoding` is deprecated. Plone only supports UTF-8 currently. This method always returns "utf-8"
  from Products.CMFPlone.utils import getSiteEncoding
/Users/kimnguyen/src/myaddoneggs/zope.deprecation-4.4.0-py3.7.egg/zope/deprecation/deprecation.py:88: DeprecationWarning: isDefaultPage is deprecated. Import from Products.CMFPlone.defaultpage instead
  name)
/Users/kimnguyen/src/myaddoneggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/fields.py:532: UserWarning: You did not specify an i18n translation domain for the 'title' field in /Users/kimnguyen/src/myaddonsrc/xxx/conferencepolicy/tiles/configure.zcml
  "'%s' field in %s" % (self.getName(), context.info.file)
/Users/kimnguyen/src/myaddoneggs/Products.CMFPlone-5.2.1-py3.7.egg/Products/CMFPlone/resources/browser/combine.py:53: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
  logger.warn(u'Could not find resource {0}. You may have to create it first.'.format(path))  # noqa
/Users/kimnguyen/src/myaddoneggs/plone.resource-2.1.1-py3.7.egg/plone/resource/manifest.py:82: DeprecationWarning: The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.
  parser = SafeConfigParser()
/Users/kimnguyen/src/myaddoneggs/plone.app.contenttypes-2.1.5-py3.7.egg/plone/app/contenttypes/indexers.py:166: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
  u'please reindex!'.format(obj.absolute_url())
in 8.370 seconds.
  Set up myaddon.testing.myaddonLayer:IntegrationTesting in 0.000 seconds.
  Running:
    2/4 (50.0%)/Users/kimnguyen/src/myaddoneggs/Products.CMFPlone-5.2.1-py3.7.egg/Products/CMFPlone/controlpanel/browser/quickinstaller.py:56: DeprecationWarning: isProductInstalled is deprecated since Plone 5.1. It will be removed in Plone 6.0. Use is_product_installed instead.
  DeprecationWarning)
    3/4 (75.0%)/Users/kimnguyen/src/myaddoneggs/Products.CMFPlone-5.2.1-py3.7.egg/Products/CMFPlone/controlpanel/browser/quickinstaller.py:473: DeprecationWarning: uninstallProducts is deprecated since Plone 5.1. It will be removed in Plone 6.0. Use uninstall_product with a single product instead. All keyword arguments are ignored.
  DeprecationWarning)
                
  Ran 4 tests with 0 failures, 1 errors, 0 skipped in 0.272 seconds.
Tearing down left over layers:
  Tear down myaddon.testing.myaddonLayer:IntegrationTesting in 0.000 seconds.
  Tear down myaddon.testing.myaddonLayer in 0.011 seconds.
  Tear down plone.app.contenttypes.testing.PloneAppContenttypes in 0.056 seconds.
  Tear down plone.app.event.testing.PAEventLayer /Users/kimnguyen/src/myaddoneggs/plone.app.event-3.2.6-py3.7.egg/plone/app/event/testing.py:84: DeprecationWarning: uninstallProduct is deprecated. Please import from plone.testing.zope.
  z2.uninstallProduct(app, 'Products.DateRecurringIndex')
in 0.009 seconds.
  Tear down plone.app.testing.layers.PloneFixture in 0.093 seconds.
  Tear down plone.testing.zope.Startup in 0.011 seconds.
  Tear down plone.testing.zca.LayerCleanup in 0.000 seconds.

Test-modules with import problems:
  lineage.registry.src.lineage.registry.tests
kimnguyen in ~/src/myaddon2/myaddon on master*
23:18 $ 

This is what I got playing with debug:

>>> site=app['Plone2']
>>> folder=site['folder-1']
>>> from zope.component.interfaces import ISite
>>> ISite.providedBy(folder)
True
>>> from zope.component import getUtility
>>> from plone.registry.interfaces import IRegistry
>>> from zope.component.hooks import setSite
>>> setSite(folder)
>>> from zope.component.hooks import getSite
>>> getSite()
<Folder at /Plone2/folder-1>
>>> sub_registry = getUtility(IRegistry)
>>> sub_registry
<plone.app.registry.registry.Registry object at 0x10cdeedd0 oid 0x3cf01 in <Connection at 10bf1a790>>

whereas I was expecting to get something like what is in the proxy.rst test,

<LineageRegistry at /plone/child/lineage_registry>

and then I put a pdb in the enableChildRegistry event handler but it did not seem to ever get called.

@thet @jensens @rnixx could you please give me (tkimnguyen) and/or collective and/or sixfeetup maintainer or owner role on https://pypi.org/project/lineage.registry/? @cdw9 and I have a Plone 5.2/Python 3 update of https://github.com/collective/lineage.registry :slight_smile: that lets lineage.themeselection work

Did it!
For: lineage.themeselection, lineage.registry and lineage.controlpanels.

@tkimnguyen who has access to the collective user on pypi? My last some-years-old info was that it's unknown. I'd like to pass all my collective repos to plone or a community managed collective owner.

1 Like

Thanks @thet!

A few of us have the collective password, shared in LastPass. I canโ€™t recall now who exactly has access to it. We looked into a Foundation LastPass non-profit enterprise subscription but it was too expensive.

Yeah, a few years ago I asked EVERYONE and finally someone had it.

1 Like

The great news is that lineage.themeselection master branch works nicely with Plone 5.2 on Python 3. It was a small fix: event handler registration tweak and a Python 3 compatibility check to avoid using Python 2โ€™s basestring. I will release to pypi later today.

1 Like

I released a lineage.registry 1.5 after some housekeeping.

1 Like

Thanks for those cleanups. Any ideas on why event handler registration didnโ€™t work the same way?