diff --git a/setup.py b/setup.py
index 3ffd36bf..3b6c4466 100644
--- a/setup.py
+++ b/setup.py
@@ -49,10 +49,7 @@
'ExtensionClass',
'collective.z3cform.datagridfield',
'collective.contact.widget >= 1.12',
- 'collective.dexteritytextindexer',
'setuptools',
- 'ecreall.helpers.upgrade >= 1.1.6.dev0',
- 'five.grok',
'five.globalrequest',
'plone.api>=1.4.11',
'plone.app.dexterity',
@@ -61,8 +58,7 @@
'plone.app.relationfield',
'plone.app.textfield!=1.2.8',
'plone.autoform',
- 'plone.formwidget.datetime',
- 'plone.formwidget.masterselect>=1.3,<2.0.0',
+ 'plone.formwidget.masterselect',
'plone.supermodel',
'Products.CMFPlone',
'vobject',
diff --git a/src/collective/contact/core/adapters.py b/src/collective/contact/core/adapters.py
index 52a59052..83c5c543 100644
--- a/src/collective/contact/core/adapters.py
+++ b/src/collective/contact/core/adapters.py
@@ -1,15 +1,11 @@
from collective.contact.core.behaviors import IBirthday
-from collective.contact.core.content.held_position import HeldPosition
from collective.contact.core.content.organization import IOrganization
-from collective.contact.core.content.organization import Organization
from collective.contact.core.interfaces import IContactable
from collective.contact.core.interfaces import IHeldPosition
from collective.contact.core.interfaces import IPersonHeldPositions
-from collective.contact.core.interfaces import IVCard
-from five import grok
from plone import api
from Products.CMFPlone.utils import safe_unicode
-from zope.interface import implements
+from zope.interface import implementer
from zope.interface import Interface
import datetime
@@ -74,9 +70,7 @@ def get_vcard(self):
return vcard
-class ContactDetailsVCard(grok.Adapter, ContactableVCard):
- grok.context(Interface)
- grok.provides(IVCard)
+class ContactDetailsVCard(ContactableVCard):
def __init__(self, context):
self.context = context
@@ -90,10 +84,8 @@ def get_vcard(self):
return vcard
-class HeldPositionVCard(grok.Adapter, ContactableVCard):
- grok.implements(IHeldPosition)
- grok.context(HeldPosition)
- grok.provides(IVCard)
+@implementer(IHeldPosition)
+class HeldPositionVCard(ContactableVCard):
def __init__(self, context):
self.context = context
@@ -147,10 +139,8 @@ def get_vcard(self):
return vcard
-class OrganizationVCard(grok.Adapter, ContactableVCard):
- grok.implements(IOrganization)
- grok.context(Organization)
- grok.provides(IVCard)
+@implementer(IOrganization)
+class OrganizationVCard(ContactableVCard):
def __init__(self, context):
self.context = context
@@ -182,8 +172,8 @@ def sort_closed_positions(position1, position2):
return cmp(position1.end_date, position2.end_date)
+@implementer(IPersonHeldPositions)
class PersonHeldPositionsAdapter(object):
- implements(IPersonHeldPositions)
def __init__(self, person):
self.person = person
diff --git a/src/collective/contact/core/behaviors.py b/src/collective/contact/core/behaviors.py
index 1b7f0601..1dc16f8b 100644
--- a/src/collective/contact/core/behaviors.py
+++ b/src/collective/contact/core/behaviors.py
@@ -8,17 +8,22 @@
from plone.app.textfield import RichText
from plone.autoform import directives as form
from plone.autoform.interfaces import IFormFieldProvider
-from plone.formwidget.datetime.z3cform.widget import DateFieldWidget
+from plone.app.z3cform.widget import DatetimeFieldWidget
from plone.formwidget.masterselect import MasterSelectBoolField
from plone.supermodel import model
from plone.supermodel.directives import fieldset
-from Products.CMFDefault.exceptions import EmailAddressInvalid
-from Products.CMFDefault.utils import checkEmailAddress
from z3c.form.widget import ComputedWidgetAttribute
from zope import schema
from zope.interface import alsoProvides
from zope.interface import Interface
+try:
+ from Products.CMFDefault.exceptions import EmailAddressInvalid
+ from Products.CMFDefault.utils import checkEmailAddress
+except ImportError:
+ from Products.CMFPlone.RegistrationTool import checkEmailAddress
+ from Products.CMFPlone.RegistrationTool import EmailAddressInvalid
+
import datetime
import re
@@ -318,7 +323,7 @@ def default_use_parent_address(adapter):
class IBirthday(model.Schema):
- form.widget(birthday=DateFieldWidget)
+ form.widget(birthday=DatetimeFieldWidget)
birthday = schema.Date(
title=_("Birthday"),
required=False,
diff --git a/src/collective/contact/core/behaviors.zcml b/src/collective/contact/core/behaviors.zcml
index 7cb5f056..0285e007 100644
--- a/src/collective/contact/core/behaviors.zcml
+++ b/src/collective/contact/core/behaviors.zcml
@@ -2,13 +2,10 @@
xmlns="http://namespaces.zope.org/zope"
xmlns:plone="http://namespaces.plone.org/plone"
xmlns:i18n="http://namespaces.zope.org/i18n"
- xmlns:grok="http://namespaces.zope.org/grok"
i18n_domain="collective.contact.core">
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/src/collective/contact/core/browser/basefields/views.py b/src/collective/contact/core/browser/basefields/views.py
index 7cbc4492..5d0a52e9 100644
--- a/src/collective/contact/core/browser/basefields/views.py
+++ b/src/collective/contact/core/browser/basefields/views.py
@@ -1,20 +1,13 @@
from AccessControl import getSecurityManager
from collective.contact.core.behaviors import IBirthday
from collective.contact.core.browser.utils import date_to_DateTime
-from collective.contact.core.content.organization import IOrganization
-from collective.contact.core.content.person import IPerson
-from collective.contact.core.content.position import IPosition
from collective.contact.core.interfaces import IContactCoreParameters
-from collective.contact.core.interfaces import IHeldPosition
-from five import grok
from plone import api
+from Products.Five import BrowserView
from zope.component import getUtility
from zope.schema.interfaces import IVocabularyFactory
-grok.templatedir('templates')
-
-
class BaseFields(object):
def display_below_content_title(self):
@@ -24,11 +17,7 @@ def display_below_content_title(self):
default=False)
-class PersonBaseFields(grok.View, BaseFields):
- grok.name('basefields')
- grok.template('person')
- grok.context(IPerson)
-
+class PersonBaseFields(BrowserView):
name = ''
birthday = ''
person_title = ''
@@ -58,13 +47,12 @@ def update(self):
self.gender = person.gender or ''
self.can_edit = sm.checkPermission('Modify portal content', person)
+ def __call__(self):
+ self.update()
+ return super(PersonBaseFields, self).__call__()
-class OrganizationBaseFields(grok.View, BaseFields):
-
- grok.name('basefields')
- grok.template('organization')
- grok.context(IOrganization)
+class OrganizationBaseFields(BrowserView):
name = ''
type = ''
positions = []
@@ -83,13 +71,12 @@ def update(self):
pass
self.activity = self.context.activity
+ def __call__(self):
+ self.update()
+ return super(OrganizationBaseFields, self).__call__()
-class PositionBaseFields(grok.View, BaseFields):
-
- grok.name('basefields')
- grok.template('position')
- grok.context(IPosition)
+class PositionBaseFields(BrowserView):
name = ''
type = ''
@@ -101,12 +88,12 @@ def update(self):
vocabulary = factory(self.context)
self.type = vocabulary.getTerm(position.position_type).title
+ def __call__(self):
+ self.update()
+ return super(PositionBaseFields, self).__call__()
-class HeldPositionBaseFields(grok.View, BaseFields):
- grok.name('basefields')
- grok.template('held_position')
- grok.context(IHeldPosition)
+class HeldPositionBaseFields(BrowserView):
start_date = ''
end_date = ''
birthday = ''
@@ -139,3 +126,7 @@ def update(self):
self.title = held_position.get_full_title()
self.position = held_position.get_position()
+
+ def __call__(self):
+ self.update()
+ return super(HeldPositionBaseFields, self).__call__()
diff --git a/src/collective/contact/core/browser/configure.zcml b/src/collective/contact/core/browser/configure.zcml
index 409b9408..48d811db 100644
--- a/src/collective/contact/core/browser/configure.zcml
+++ b/src/collective/contact/core/browser/configure.zcml
@@ -6,16 +6,29 @@
i18n_domain="collective.contact.core">
+
+
+
+
+
@@ -87,13 +100,6 @@
permission="cmf.AddPortalContent"
/>
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/collective/contact/core/browser/contactable.py b/src/collective/contact/core/browser/contactable.py
index bf55b397..84ca9b7e 100644
--- a/src/collective/contact/core/browser/contactable.py
+++ b/src/collective/contact/core/browser/contactable.py
@@ -6,25 +6,23 @@
from collective.contact.core.browser.utils import get_valid_url
from collective.contact.core.interfaces import IContactable
from collective.contact.core.interfaces import IContactCoreParameters
-from collective.contact.widget.interfaces import IContactContent
-from five import grok
from plone import api
from plone.dexterity.browser.view import DefaultView
from plone.dexterity.utils import getAdditionalSchemata
+from Products.Five import BrowserView
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from zope.globalrequest import getRequest
-from zope.interface import Interface
+from zope.interface import implementer
import os.path
-grok.templatedir(TEMPLATES_DIR)
-
-
-class ContactDetailsContactable(grok.Adapter):
+@implementer(IContactable)
+class ContactDetailsContactable(object):
"""Common adapter class for objects that just implement the IContactDetails behavior"""
- grok.provides(IContactable)
- grok.context(Interface)
+
+ def __init__(self, context):
+ self.context = context
def get_contact_details(self, keys=(), fallback=True):
if not IContactDetails.providedBy(self.context):
@@ -56,35 +54,33 @@ def get_parent_address(self):
return u""
-class ContactDetails(grok.View):
- grok.name('contactdetails')
- grok.template('contactdetails')
- grok.context(IContactContent)
+class ContactDetails(BrowserView):
+ address_template = ViewPageTemplateFile('templates/address.pt')
- template_path = os.path.join(TEMPLATES_DIR, 'address.pt')
+ def __call__(self):
+ self.update()
+ return super(ContactDetails, self).__call__()
def update(self):
contactable = IContactable(self.context)
self.contact_details = contactable.get_contact_details()
def render_address(self):
- template = ViewPageTemplateFile(self.template_path)
- return template(self, self.contact_details['address'])
+ return self.address_template()
class NoFallbackContactDetails(ContactDetails):
- grok.name('nofallbackcontactdetails')
def update(self):
contactable = IContactable(self.context)
self.contact_details = contactable.get_contact_details(fallback=False)
-class Contactable(grok.Adapter):
- """Base adapter class for contact content types with fallback system"""
- grok.provides(IContactable)
- grok.context(IContactContent)
- grok.baseclass()
+@implementer(IContactable)
+class Contactable(object):
+
+ def __init__(self, context):
+ self.context = context
@property
def person(self):
diff --git a/src/collective/contact/core/browser/excelexport.py b/src/collective/contact/core/browser/excelexport.py
index 5c453ac5..613f97f9 100644
--- a/src/collective/contact/core/browser/excelexport.py
+++ b/src/collective/contact/core/browser/excelexport.py
@@ -9,8 +9,11 @@
from Products.CMFPlone.utils import safe_unicode
from zope.component import adapts
from zope.component import getMultiAdapter
-from zope.component.interfaces import ComponentLookupError
-from zope.interface import implements
+try:
+ from zope.interface.interfaces import ComponentLookupError
+except ImportError:
+ from zope.component.interfaces import ComponentLookupError
+from zope.interface import implementer
from zope.interface import Interface
@@ -84,9 +87,9 @@ def get_exportables(self):
return exportables
+ @implementer(IFieldValueGetter)
class ContactValueGetter(object):
adapts(IContactContent)
- implements(IFieldValueGetter)
def __init__(self, context):
self.context = context
diff --git a/src/collective/contact/core/browser/excelexport.zcml b/src/collective/contact/core/browser/excelexport.zcml
index aef35bda..62750c52 100644
--- a/src/collective/contact/core/browser/excelexport.zcml
+++ b/src/collective/contact/core/browser/excelexport.zcml
@@ -2,7 +2,6 @@
xmlns="http://namespaces.zope.org/zope"
xmlns:zcml="http://namespaces.zope.org/zcml"
xmlns:five="http://namespaces.zope.org/five"
- xmlns:grok="http://namespaces.zope.org/grok"
xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
diff --git a/src/collective/contact/core/browser/organization.py b/src/collective/contact/core/browser/organization.py
index a475bfff..8228b8ea 100644
--- a/src/collective/contact/core/browser/organization.py
+++ b/src/collective/contact/core/browser/organization.py
@@ -5,10 +5,8 @@
from collective.contact.core.browser.contactable import BaseView
from collective.contact.core.browser.utils import date_to_DateTime
from collective.contact.core.browser.utils import get_valid_url
-from collective.contact.core.content.organization import IOrganization
from collective.contact.core.interfaces import IContactable
from collective.contact.core.interfaces import IContactCoreParameters
-from five import grok
from plone import api
from Products.Five import BrowserView
@@ -33,13 +31,9 @@
"""
-grok.templatedir('templates')
-
-
class Organization(BaseView):
def update(self):
- super(Organization, self).update()
self.organization = self.context
organization = self.organization
@@ -76,14 +70,11 @@ def __call__(self):
return self.index()
-class OtherContacts(grok.View):
+class OtherContacts(BrowserView):
"""Displays other contacts list"""
- grok.name('othercontacts')
- grok.context(IOrganization)
-
held_positions = ''
- def update(self):
+ def __call__(self):
organization = self.context
othercontacts = []
held_positions = organization.get_held_positions()
diff --git a/src/collective/contact/core/browser/person.py b/src/collective/contact/core/browser/person.py
index 7ae9909a..85e9033c 100644
--- a/src/collective/contact/core/browser/person.py
+++ b/src/collective/contact/core/browser/person.py
@@ -1,15 +1,10 @@
from AccessControl import getSecurityManager
from collective.contact.core.behaviors import IContactDetails
-from collective.contact.core.browser import TEMPLATES_DIR
from collective.contact.core.browser.contactable import BaseView
from collective.contact.core.browser.utils import date_to_DateTime
-from collective.contact.core.content.person import IPerson
from collective.contact.core.interfaces import IContactable
from collective.contact.core.interfaces import IPersonHeldPositions
-from five import grok
-
-
-grok.templatedir(TEMPLATES_DIR)
+from Products.Five import BrowserView
class Person(BaseView):
@@ -25,15 +20,11 @@ def update(self):
self.show_contact_details = True
-class HeldPositions(grok.View):
+class HeldPositions(BrowserView):
"""Displays held positions list"""
- grok.name('heldpositions')
- grok.template('heldpositions')
- grok.context(IPerson)
-
held_positions = ''
- def update(self):
+ def __call__(self):
person = self.context
sm = getSecurityManager()
held_positions = []
@@ -63,3 +54,4 @@ def update(self):
held_positions.append(held_position)
self.held_positions = held_positions
+ return super(HeldPositions, self).__call__()
diff --git a/src/collective/contact/core/browser/person_title_mapping.py b/src/collective/contact/core/browser/person_title_mapping.py
index 11f168c5..39c76060 100644
--- a/src/collective/contact/core/browser/person_title_mapping.py
+++ b/src/collective/contact/core/browser/person_title_mapping.py
@@ -1,21 +1,16 @@
# -*- coding: utf-8 -*-
from collective.contact.core import _
-from five import grok
+from Products.Five import BrowserView
from zope.i18n import translate
-from zope.interface import Interface
import json
-class GenderPersonTitleMapping(grok.View):
+class GenderPersonTitleMapping(BrowserView):
"""Return gender/person_title mapping in json."""
- grok.name("gender_person_title_mapping.json")
- grok.context(Interface)
- grok.require('zope2.View')
-
- def render(self):
+ def __call__(self):
request = self.request
request.response.setHeader(
'Content-Type', 'application/json')
diff --git a/src/collective/contact/core/browser/ttwfields.py b/src/collective/contact/core/browser/ttwfields.py
index b964bc4b..7e1bedcf 100644
--- a/src/collective/contact/core/browser/ttwfields.py
+++ b/src/collective/contact/core/browser/ttwfields.py
@@ -1,22 +1,14 @@
-from collective.contact.core.browser import TEMPLATES_DIR
from collective.contact.core.browser.utils import get_ttw_fields
-from five import grok
-from zope.interface import Interface
+from Products.Five import BrowserView
-grok.templatedir(TEMPLATES_DIR)
-
-
-class TTWFields(grok.View):
+class TTWFields(BrowserView):
"""Show fields that were added TTW
"""
- grok.name('ttwfields')
- grok.template('ttwfields')
- grok.context(Interface)
- def update(self):
+ def __call__(self):
contact_view = self.context.unrestrictedTraverse('view')
contact_view.update()
self.widgets = contact_view.widgets
ttw_fields = get_ttw_fields(self.context)
- self.ttw_fields = [field for field in ttw_fields if field in self.widgets.keys()]
+ self.ttw_fields = [field for field in ttw_fields if field in list(self.widgets.keys())]
diff --git a/src/collective/contact/core/browser/utils.py b/src/collective/contact/core/browser/utils.py
index c62bc900..d65d4975 100644
--- a/src/collective/contact/core/browser/utils.py
+++ b/src/collective/contact/core/browser/utils.py
@@ -29,7 +29,7 @@ def get_ttw_fields(obj):
original_schema = schema_policy.bases(None, None)[0]
original_fields = schema.getFieldsInOrder(original_schema)
new_fields = [field[0] for field in all_fields
- if field[0] not in dict(original_fields).keys()]
+ if field[0] not in list(dict(original_fields).keys())]
for behavior_id in fti.behaviors:
behavior = getUtility(IBehavior, behavior_id).interface
diff --git a/src/collective/contact/core/browser/vcard_export.py b/src/collective/contact/core/browser/vcard_export.py
index 352369f2..c85b9eab 100644
--- a/src/collective/contact/core/browser/vcard_export.py
+++ b/src/collective/contact/core/browser/vcard_export.py
@@ -1,14 +1,11 @@
from collective.contact.core.interfaces import IVCard
from collective.contact.widget.interfaces import IContactContent
-from five import grok
+from Products.Five import BrowserView
-class ContactVCF(grok.View):
- grok.name('contact.vcf')
- grok.context(IContactContent)
- grok.require("zope2.View")
+class ContactVCF(BrowserView):
- def render(self):
+ def __call__(self):
self.request.response.setHeader(
'Content-type', "text/x-vCard; charset=utf-8")
content_disposition = 'attachment; filename=%s.vcf' % (self.context.id)
diff --git a/src/collective/contact/core/configure.zcml b/src/collective/contact/core/configure.zcml
index 2ad5205e..761a7c68 100644
--- a/src/collective/contact/core/configure.zcml
+++ b/src/collective/contact/core/configure.zcml
@@ -1,31 +1,31 @@
-
-
-
-
-
-
+
-
+
+
+
+
-
+ /> MIGRATION-PLONE6 -->
-
+ provides="collective.dexteritytextindexer.interfaces.IDexterityTextIndexFieldConverter" /> MIGRATION-PLONE6 -->
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
diff --git a/src/collective/contact/core/content/configure.zcml b/src/collective/contact/core/content/configure.zcml
new file mode 100644
index 00000000..bf3b8b42
--- /dev/null
+++ b/src/collective/contact/core/content/configure.zcml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/collective/contact/core/content/directory.py b/src/collective/contact/core/content/directory.py
index da0479ee..bafac3e5 100644
--- a/src/collective/contact/core/content/directory.py
+++ b/src/collective/contact/core/content/directory.py
@@ -1,7 +1,6 @@
from collective.contact.core import _
-from collective.z3cform.datagridfield import DataGridFieldFactory
-from collective.z3cform.datagridfield import DictRow
-from five import grok
+from collective.z3cform.datagridfield.datagridfield import DataGridFieldFactory
+from collective.z3cform.datagridfield.row import DictRow
from plone.autoform.directives import widget
from plone.dexterity.content import Container
from plone.dexterity.schema import DexteritySchemaPolicy
@@ -9,7 +8,7 @@
from plone.supermodel import model
from zope import schema
from zope.component import getUtility
-from zope.interface import implements
+from zope.interface import implementer
from zope.interface import Interface
@@ -53,15 +52,13 @@ class IDirectory(model.Schema):
widget('organization_levels', DataGridFieldFactory, allow_reorder=True)
+@implementer(IDirectory)
class Directory(Container):
"""Directory content type"""
- implements(IDirectory)
-class DirectorySchemaPolicy(grok.GlobalUtility,
- DexteritySchemaPolicy):
+class DirectorySchemaPolicy(DexteritySchemaPolicy):
"""Schema policy for Directory content type"""
- grok.name("schema_policy_directory")
def bases(self, schemaName, tree):
return (IDirectory, )
diff --git a/src/collective/contact/core/content/held_position.py b/src/collective/contact/core/content/held_position.py
index 266dbfe6..6ba4b93c 100644
--- a/src/collective/contact/core/content/held_position.py
+++ b/src/collective/contact/core/content/held_position.py
@@ -1,13 +1,12 @@
from collective.contact.core.browser.contactable import Contactable
from collective.contact.core.interfaces import IHeldPosition
from ComputedAttribute import ComputedAttribute
-from five import grok
from plone.dexterity.content import Container
from plone.dexterity.schema import DexteritySchemaPolicy
from Products.CMFPlone.utils import normalizeString
from Products.CMFPlone.utils import safe_unicode
from z3c.form.interfaces import NO_VALUE
-from zope.interface import implements
+from zope.interface import implementer
def acqproperty(func):
@@ -18,8 +17,6 @@ def acqproperty(func):
class HeldPositionContactableAdapter(Contactable):
"""Contactable adapter for HeldPosition content type"""
- grok.context(IHeldPosition)
-
@property
def person(self):
return self.context.get_person()
@@ -34,13 +31,11 @@ def organizations(self):
return organization and organization.get_organizations_chain() or []
+@implementer(IHeldPosition)
class HeldPosition(Container):
"""HeldPosition content type
Links a Position or an Organization to a person in an organization
"""
-
- implements(IHeldPosition)
-
use_parent_address = NO_VALUE
parent_address = NO_VALUE
@@ -146,11 +141,8 @@ def photo(self):
return person.photo
-class HeldPositionSchemaPolicy(grok.GlobalUtility,
- DexteritySchemaPolicy):
+class HeldPositionSchemaPolicy(DexteritySchemaPolicy):
"""Schema policy for HeldPosition content type"""
- grok.name("schema_policy_held_position")
-
def bases(self, schemaName, tree):
return (IHeldPosition,)
diff --git a/src/collective/contact/core/content/organization.py b/src/collective/contact/core/content/organization.py
index 2816a400..677bd58f 100644
--- a/src/collective/contact/core/content/organization.py
+++ b/src/collective/contact/core/content/organization.py
@@ -5,7 +5,6 @@
from collective.contact.core.browser.contactable import Contactable
from collective.contact.core.interfaces import IHeldPosition
from collective.contact.widget.interfaces import IContactContent
-from five import grok
from plone import api
from plone.app.textfield import RichText
from plone.dexterity.content import Container
@@ -16,7 +15,7 @@
from zc.relation.interfaces import ICatalog
from zope import schema
from zope.component import getUtility
-from zope.interface import implements
+from zope.interface import implementer
from zope.intid.interfaces import IIntIds
@@ -95,16 +94,14 @@ def get_held_positions(self):
class OrganizationContactableAdapter(Contactable):
"""Contactable adapter for Organization content type"""
- grok.context(IOrganization)
-
@property
def organizations(self):
return self.context.get_organizations_chain()
+@implementer(IOrganization)
class Organization(Container):
"""Organization content type"""
- implements(IOrganization)
def get_organizations_chain(self, first_index=0):
"""Returns the list of organizations and sub-organizations in this organization
@@ -177,11 +174,8 @@ def get_held_positions(self):
return held_positions
-class OrganizationSchemaPolicy(grok.GlobalUtility,
- DexteritySchemaPolicy):
+class OrganizationSchemaPolicy(DexteritySchemaPolicy):
"""Schema policy for Organization content type"""
- grok.name("schema_policy_organization")
-
def bases(self, schemaName, tree):
return (IOrganization,)
diff --git a/src/collective/contact/core/content/person.py b/src/collective/contact/core/content/person.py
index ebdb782d..ef05f6b1 100644
--- a/src/collective/contact/core/content/person.py
+++ b/src/collective/contact/core/content/person.py
@@ -7,7 +7,6 @@
from collective.contact.core.interfaces import IHeldPosition
from collective.contact.core.interfaces import IPersonHeldPositions
from collective.contact.widget.interfaces import IContactContent
-from five import grok
from plone.autoform import directives as form
from plone.dexterity.content import Container
from plone.dexterity.schema import DexteritySchemaPolicy
@@ -20,7 +19,7 @@
from zope import schema
from zope.cachedescriptors.property import CachedProperty
from zope.component import queryUtility
-from zope.interface import implements
+from zope.interface import implementer
class IPerson(model.Schema, IContactContent):
@@ -64,8 +63,6 @@ def get_held_positions(self):
class PersonContactableAdapter(Contactable):
"""Contactable adapter for Person content type"""
- grok.context(IPerson)
-
@property
def person(self):
return self.context
@@ -89,11 +86,10 @@ def organizations(self):
return ()
+@implementer(IPerson)
class Person(Container):
"""Person content type"""
- implements(IPerson)
-
# plone.dexterity.content.Content.__getattr__ retrieve the field.default
# so step 1.2.1 in z3c.form.widget.py returns something instead of NO_VALUE
# then IValue adapter is not looked up...
@@ -135,7 +131,7 @@ def get_sortable_title(self):
return normalizeString(fullname)
def get_held_positions(self):
- return [obj for obj in self.values() if IHeldPosition.providedBy(obj)]
+ return [obj for obj in list(self.values()) if IHeldPosition.providedBy(obj)]
def get_held_positions_titles(self):
return [p.Title() for p in self.get_held_positions()]
@@ -144,11 +140,8 @@ def get_full_name(self):
return u' '.join([x for x in (self.firstname, self.lastname) if x])
-class PersonSchemaPolicy(grok.GlobalUtility,
- DexteritySchemaPolicy):
+class PersonSchemaPolicy(DexteritySchemaPolicy):
"""Schema policy for Person content type"""
- grok.name("schema_policy_person")
-
def bases(self, schemaName, tree):
return (IPerson, )
diff --git a/src/collective/contact/core/content/position.py b/src/collective/contact/core/content/position.py
index e326086d..a786a33a 100644
--- a/src/collective/contact/core/content/position.py
+++ b/src/collective/contact/core/content/position.py
@@ -3,7 +3,6 @@
from collective.contact.core.browser.contactable import Contactable
from collective.contact.core.interfaces import IHeldPosition
from collective.contact.widget.interfaces import IContactContent
-from five import grok
from plone.dexterity.content import Container
from plone.dexterity.schema import DexteritySchemaPolicy
from plone.supermodel import model
@@ -11,7 +10,7 @@
from zc.relation.interfaces import ICatalog
from zope import schema
from zope.component import getUtility
-from zope.interface import implements
+from zope.interface import implementer
from zope.intid.interfaces import IIntIds
@@ -36,8 +35,6 @@ def get_full_title(self):
class PositionContactableAdapter(Contactable):
"""Contactable adapter for Position content type"""
- grok.context(IPosition)
-
@property
def position(self):
return self.context
@@ -48,11 +45,10 @@ def organizations(self):
return organization.get_organizations_chain()
+@implementer(IPosition)
class Position(Container):
"""Position content type"""
- implements(IPosition)
-
use_parent_address = NO_VALUE
parent_address = NO_VALUE
@@ -97,11 +93,8 @@ def get_held_positions(self):
return held_positions
-class PositionSchemaPolicy(grok.GlobalUtility,
- DexteritySchemaPolicy):
+class PositionSchemaPolicy(DexteritySchemaPolicy):
"""Schema policy for Position content type"""
- grok.name("schema_policy_position")
-
def bases(self, schemaName, tree):
return (IPosition,)
diff --git a/src/collective/contact/core/fti.py b/src/collective/contact/core/fti.py
index 6457db42..d1e5307d 100644
--- a/src/collective/contact/core/fti.py
+++ b/src/collective/contact/core/fti.py
@@ -3,15 +3,13 @@
from plone.supermodel import loadFile
from plone.supermodel import loadString
from plone.supermodel.model import Model
-from zope.interface import implements
+from zope.interface import implementer
+@implementer(IDexterityFTI)
class DexterityConfigurablePolicyFTI(DexterityFTI):
"""A Configurable policy FTI
"""
-
- implements(IDexterityFTI)
-
meta_type = "Dexterity configurable policy FTI"
_properties = DexterityFTI._properties + (
diff --git a/src/collective/contact/core/indexers.py b/src/collective/contact/core/indexers.py
index d3afeb22..930e40a0 100644
--- a/src/collective/contact/core/indexers.py
+++ b/src/collective/contact/core/indexers.py
@@ -9,14 +9,14 @@
from collective.contact.core.interfaces import IContactable
from collective.contact.core.interfaces import IHeldPosition
from collective.contact.widget.interfaces import IContactContent
-from collective.dexteritytextindexer.converters import DefaultDexterityTextIndexFieldConverter
-from collective.dexteritytextindexer.interfaces import IDynamicTextIndexExtender
+from plone.app.dexterity.textindexer.converters import DefaultDexterityTextIndexFieldConverter
+from plone.app.dexterity.textindexer.interfaces import IDynamicTextIndexExtender
from datetime import date
from plone import api
from plone.indexer import indexer
from Products.CMFPlone.utils import safe_unicode
from zope.component import adapts
-from zope.interface import implements
+from zope.interface import implementer
@indexer(IContactContent)
@@ -44,10 +44,10 @@ def contact_source(contact):
return u''
+@implementer(IDynamicTextIndexExtender)
class OrganizationSearchableExtender(object):
"""Extends SearchableText of an organization."""
adapts(IOrganization)
- implements(IDynamicTextIndexExtender)
def __init__(self, context):
self.context = context
@@ -72,10 +72,10 @@ def __call__(self):
return u' '.join(words)
+@implementer(IDynamicTextIndexExtender)
class HeldPositionSearchableExtender(object):
"""Extends SearchableText of a held position."""
adapts(IHeldPosition)
- implements(IDynamicTextIndexExtender)
def __init__(self, context):
self.context = context
@@ -102,10 +102,10 @@ def __call__(self):
return u' '.join(indexed_fields)
+@implementer(IDynamicTextIndexExtender)
class PositionSearchableExtender(object):
"""Extends SearchableText of a position."""
adapts(IPosition)
- implements(IDynamicTextIndexExtender)
def __init__(self, context):
self.context = context
@@ -119,10 +119,10 @@ def __call__(self):
return u' '.join(result)
+@implementer(IDynamicTextIndexExtender)
class PersonSearchableExtender(object):
"""Extends SearchableText of a position."""
adapts(IPerson)
- implements(IDynamicTextIndexExtender)
def __init__(self, context):
self.context = context
@@ -154,7 +154,7 @@ def __call__(self):
class ContactEscapingTitleFieldConverter(DefaultDexterityTextIndexFieldConverter):
- """Contact field converter for collective.dexteritytextindexer to escape title and description."""
+ """Contact field converter for dexteritytextindexer to escape title and description."""
def convert(self):
"""Convert the adapted field value to text/plain for indexing"""
diff --git a/src/collective/contact/core/profiles/default/metadata.xml b/src/collective/contact/core/profiles/default/metadata.xml
index df263ce9..2aa9774a 100644
--- a/src/collective/contact/core/profiles/default/metadata.xml
+++ b/src/collective/contact/core/profiles/default/metadata.xml
@@ -4,7 +4,6 @@
profile-collective.contact.widget:default
profile-plone.app.dexterity:default
- profile-plone.formwidget.datetime:default
profile-plone.formwidget.masterselect:default
profile-plone.app.relationfield:default
profile-collective.z3cform.datagridfield:default
diff --git a/src/collective/contact/core/profiles/default/types/held_position.xml b/src/collective/contact/core/profiles/default/types/held_position.xml
index 2b96cf59..ab07cec0 100644
--- a/src/collective/contact/core/profiles/default/types/held_position.xml
+++ b/src/collective/contact/core/profiles/default/types/held_position.xml
@@ -22,7 +22,7 @@
-
+
diff --git a/src/collective/contact/core/profiles/default/types/organization.xml b/src/collective/contact/core/profiles/default/types/organization.xml
index 49ec6741..f89be7e0 100644
--- a/src/collective/contact/core/profiles/default/types/organization.xml
+++ b/src/collective/contact/core/profiles/default/types/organization.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/src/collective/contact/core/profiles/default/types/person.xml b/src/collective/contact/core/profiles/default/types/person.xml
index 871369ee..47df2f55 100644
--- a/src/collective/contact/core/profiles/default/types/person.xml
+++ b/src/collective/contact/core/profiles/default/types/person.xml
@@ -25,7 +25,7 @@
-
+
diff --git a/src/collective/contact/core/profiles/default/types/position.xml b/src/collective/contact/core/profiles/default/types/position.xml
index d848ebb3..d292e02c 100644
--- a/src/collective/contact/core/profiles/default/types/position.xml
+++ b/src/collective/contact/core/profiles/default/types/position.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/src/collective/contact/core/subscribers.py b/src/collective/contact/core/subscribers.py
index f1b2bf32..61a49c3e 100644
--- a/src/collective/contact/core/subscribers.py
+++ b/src/collective/contact/core/subscribers.py
@@ -10,8 +10,8 @@
from collective.contact.widget.interfaces import IContactContent
from plone import api
from plone.app.iterate.interfaces import IWorkingCopy
-from plone.app.linkintegrity.handlers import referencedObjectRemoved as baseReferencedObjectRemoved
-from plone.app.linkintegrity.interfaces import ILinkIntegrityInfo
+# from plone.app.linkintegrity.handlers import referencedObjectRemoved as baseReferencedObjectRemoved # MIGRATION-PLONE6
+# from plone.app.linkintegrity.interfaces import ILinkIntegrityInfo # MIGRATION-PLONE6
from plone.registry.interfaces import IRecordModifiedEvent
from z3c.form.interfaces import NO_VALUE
from zc.relation.interfaces import ICatalog
@@ -78,7 +78,7 @@ def update_related_with_organization(obj, event=None):
held_position.reindexObject(idxs=indexes_to_update)
update_related_with_held_position(held_position)
- for child in obj.values():
+ for child in list(obj.values()):
if IOrganization.providedBy(child):
child.reindexObject(idxs=indexes_to_update)
update_related_with_organization(child)
@@ -94,7 +94,8 @@ def referenceRemoved(obj, event, toInterface=IContactContent):
request = aq_get(obj, 'REQUEST', None)
if not request:
return
- storage = ILinkIntegrityInfo(request)
+ # storage = ILinkIntegrityInfo(request) # MIGRATION-PLONE6
+ storage = None
catalog = component.queryUtility(ICatalog)
intids = component.queryUtility(IIntIds)
@@ -121,7 +122,8 @@ def referencedObjectRemoved(obj, event):
if IWorkingCopy.providedBy(obj):
return
if not IReferenceable.providedBy(obj):
- baseReferencedObjectRemoved(obj, event)
+ pass
+ # baseReferencedObjectRemoved(obj, event) # MIGRATION-PLONE6
def clear_fields_use_parent_address(obj, event):
diff --git a/src/collective/contact/core/subscribers.zcml b/src/collective/contact/core/subscribers.zcml
new file mode 100644
index 00000000..d6ced504
--- /dev/null
+++ b/src/collective/contact/core/subscribers.zcml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/collective/contact/core/tests/test_content_types.py b/src/collective/contact/core/tests/test_content_types.py
index 644a3c6e..3ad986d2 100644
--- a/src/collective/contact/core/tests/test_content_types.py
+++ b/src/collective/contact/core/tests/test_content_types.py
@@ -89,7 +89,7 @@ def test_no_person_title(self):
def test_copy_paste(self):
cb = self.mydirectory.manage_copyObjects(['pepper'])
self.mydirectory.manage_pasteObjects(cb)
- self.assertIn('copy_of_pepper', self.mydirectory.keys())
+ self.assertIn('copy_of_pepper', list(self.mydirectory.keys()))
class TestOrganization(TestContentTypes):
@@ -134,13 +134,13 @@ def test_get_organizations_titles(self):
corpsa_titles = self.corpsa.get_organizations_titles()
self.assertIn(u'Armée de terre', corpsa_titles)
self.assertIn(u'Corps A', corpsa_titles)
- self.assertEquals(len(corpsa_titles), 2)
+ self.assertEqual(len(corpsa_titles), 2)
division_alpha_titles = self.divisionalpha.get_organizations_titles()
self.assertIn(u'Armée de terre', division_alpha_titles)
self.assertIn(u'Corps A', division_alpha_titles)
self.assertIn(u'Division Alpha', division_alpha_titles)
- self.assertEquals(len(division_alpha_titles), 3)
+ self.assertEqual(len(division_alpha_titles), 3)
brigadelh_titles = self.brigadelh.get_organizations_titles()
self.assertIn(u'Armée de terre', brigadelh_titles)
@@ -148,13 +148,13 @@ def test_get_organizations_titles(self):
self.assertIn(u'Division Alpha', brigadelh_titles)
self.assertIn(u'Régiment H', brigadelh_titles)
self.assertIn(u'Brigade LH', brigadelh_titles)
- self.assertEquals(len(brigadelh_titles), 5)
+ self.assertEqual(len(brigadelh_titles), 5)
brigadelh_titles = self.brigadelh.get_organizations_titles(first_index=2)
self.assertIn(u'Division Alpha', brigadelh_titles)
self.assertIn(u'Régiment H', brigadelh_titles)
self.assertIn(u'Brigade LH', brigadelh_titles)
- self.assertEquals(len(brigadelh_titles), 3)
+ self.assertEqual(len(brigadelh_titles), 3)
def test_get_full_title(self):
self.assertEqual(self.armeedeterre.get_full_title(),
@@ -178,21 +178,21 @@ def test_reindex_suborganization(self):
def test_copy_paste(self):
cb = self.mydirectory.manage_copyObjects(['armeedeterre'])
self.mydirectory.manage_pasteObjects(cb)
- self.assertIn('copy_of_armeedeterre', self.mydirectory.keys())
+ self.assertIn('copy_of_armeedeterre', list(self.mydirectory.keys()))
def test_get_positions(self):
# add some positions to self.armeedeterre
self.armeedeterre.invokeFactory('position', 'colonel_adt', title="Colonel de l'armée de terre")
self.armeedeterre.invokeFactory('position', 'lieutenant_adt', title="Lieutenant de l'armée de terre")
self.armeedeterre.invokeFactory('position', 'sergent_adt', title="Sergent de l'armée de terre")
- self.assertEquals(
+ self.assertEqual(
[pos.id for pos in self.armeedeterre.get_positions()],
['general_adt', 'colonel_adt', 'lieutenant_adt', 'sergent_adt'])
# get_positions sorts positions using getObjPositionInParent
# move 'general_adt' to last position
self.armeedeterre.moveObjectToPosition(
'general_adt', len(self.armeedeterre.objectIds()))
- self.assertEquals(
+ self.assertEqual(
[pos.id for pos in self.armeedeterre.get_positions()],
['colonel_adt', 'lieutenant_adt', 'sergent_adt', 'general_adt'])
@@ -217,7 +217,7 @@ def test_get_full_title(self):
def test_copy_paste(self):
cb = self.armeedeterre.manage_copyObjects(['general_adt'])
self.armeedeterre.manage_pasteObjects(cb)
- self.assertIn('copy_of_general_adt', self.armeedeterre.keys())
+ self.assertIn('copy_of_general_adt', list(self.armeedeterre.keys()))
class TestHeldPosition(TestContentTypes):
diff --git a/src/collective/contact/core/upgrades/configure.zcml b/src/collective/contact/core/upgrades/configure.zcml
index dad31bbb..202faa82 100644
--- a/src/collective/contact/core/upgrades/configure.zcml
+++ b/src/collective/contact/core/upgrades/configure.zcml
@@ -3,204 +3,4 @@
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
i18n_domain="collective.contact.core">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/collective/contact/core/upgrades/profiles/v2/catalog.xml b/src/collective/contact/core/upgrades/profiles/v2/catalog.xml
deleted file mode 100644
index e4da0875..00000000
--- a/src/collective/contact/core/upgrades/profiles/v2/catalog.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
\ No newline at end of file
diff --git a/src/collective/contact/core/upgrades/profiles/v2/cssregistry.xml b/src/collective/contact/core/upgrades/profiles/v2/cssregistry.xml
deleted file mode 100644
index 81a5b922..00000000
--- a/src/collective/contact/core/upgrades/profiles/v2/cssregistry.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
\ No newline at end of file
diff --git a/src/collective/contact/core/upgrades/profiles/v2/jsregistry.xml b/src/collective/contact/core/upgrades/profiles/v2/jsregistry.xml
deleted file mode 100644
index 56a89766..00000000
--- a/src/collective/contact/core/upgrades/profiles/v2/jsregistry.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
\ No newline at end of file
diff --git a/src/collective/contact/core/upgrades/profiles/v2/skins.xml b/src/collective/contact/core/upgrades/profiles/v2/skins.xml
deleted file mode 100644
index bc9f5a46..00000000
--- a/src/collective/contact/core/upgrades/profiles/v2/skins.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
\ No newline at end of file
diff --git a/src/collective/contact/core/upgrades/profiles/v2/types/directory.xml b/src/collective/contact/core/upgrades/profiles/v2/types/directory.xml
deleted file mode 100644
index 502cb0dd..00000000
--- a/src/collective/contact/core/upgrades/profiles/v2/types/directory.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
- Directory
-
- string:${portal_url}/directory_icon.png
- directory
- string:${folder_url}/++add++directory
-
- view
- True
- True
-
-
-
-
- False
- view
-
-
-
- False
- cmf.AddPortalContent
- collective.contact.core.content.directory.Directory
-
-
-
-
-
-
-
- schema_policy_directory
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/collective/contact/core/upgrades/profiles/v2/types/held_position.xml b/src/collective/contact/core/upgrades/profiles/v2/types/held_position.xml
deleted file mode 100644
index 9ec431dd..00000000
--- a/src/collective/contact/core/upgrades/profiles/v2/types/held_position.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
- Held position
-
- string:${portal_url}/position_icon.png
- held_position
- string:${folder_url}/++add++held_position
-
- @@contact
- False
- True
-
- False
- @@contact
-
-
- False
- cmf.AddPortalContent
- collective.contact.core.content.held_position.HeldPosition
-
-
-
-
-
-
- schema_policy_held_position
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/collective/contact/core/upgrades/profiles/v2/types/organization.xml b/src/collective/contact/core/upgrades/profiles/v2/types/organization.xml
deleted file mode 100644
index 392bd8cb..00000000
--- a/src/collective/contact/core/upgrades/profiles/v2/types/organization.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
- Organization
-
- string:${portal_url}/organization_icon.png
- organization
- string:${folder_url}/++add++organization
-
- @@organization
- False
- True
-
-
-
-
- False
- @@organization
-
-
- False
- cmf.AddPortalContent
- collective.contact.core.content.organization.Organization
-
-
-
-
-
-
-
-
- schema_policy_organization
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/collective/contact/core/upgrades/profiles/v2/types/person.xml b/src/collective/contact/core/upgrades/profiles/v2/types/person.xml
deleted file mode 100644
index 47b588c0..00000000
--- a/src/collective/contact/core/upgrades/profiles/v2/types/person.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
- Person
-
- string:${portal_url}/person_icon.png
- person
- string:${folder_url}/++add++person
-
- @@person
- False
- True
-
-
-
- False
- @@person
-
-
- False
- cmf.AddPortalContent
- collective.contact.core.content.person.Person
-
-
-
-
-
-
-
- schema_policy_person
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/collective/contact/core/upgrades/profiles/v2/types/position.xml b/src/collective/contact/core/upgrades/profiles/v2/types/position.xml
deleted file mode 100644
index 0c5329d3..00000000
--- a/src/collective/contact/core/upgrades/profiles/v2/types/position.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
- Position
-
- string:${portal_url}/position_icon.png
- position
- string:${folder_url}/++add++position
-
- @@position
- False
- True
-
- False
- @@position
-
-
- False
- cmf.AddPortalContent
- collective.contact.core.content.position.Position
-
-
-
-
-
-
-
-
- schema_policy_position
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/collective/contact/core/upgrades/profiles/v2/workflows.xml b/src/collective/contact/core/upgrades/profiles/v2/workflows.xml
deleted file mode 100644
index b13068b6..00000000
--- a/src/collective/contact/core/upgrades/profiles/v2/workflows.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
- Contains workflow definitions for your portal
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/collective/contact/core/upgrades/profiles/v2/workflows/collective_contact_core_workflow/definition.xml b/src/collective/contact/core/upgrades/profiles/v2/workflows/collective_contact_core_workflow/definition.xml
deleted file mode 100644
index 3ec71ae0..00000000
--- a/src/collective/contact/core/upgrades/profiles/v2/workflows/collective_contact_core_workflow/definition.xml
+++ /dev/null
@@ -1,114 +0,0 @@
-
-
- Access contents information
- Modify portal content
- View
-
-
-
- Manager
- Owner
- Contributor
-
-
- Manager
- Owner
- Contributor
-
-
- Manager
- Owner
- Contributor
- Member
-
-
-
-
-
- Manager
- Owner
- Contributor
-
-
- Manager
- Owner
- Contributor
-
-
- Manager
- Owner
- Contributor
-
-
-
- Activate
- The object will be visible.
-
- Modify portal content
-
-
-
- Deactivate
- The object will no longer be visible in typeahead lists
-
- Modify portal content
-
-
-
- Reviewer tasks
- Pending (%(count)d)
-
- Review portal content
-
-
-
-
- Previous transition
-
- transition/getId|nothing
-
-
-
-
-
- The ID of the user who performed the previous transition
-
- user/getId
-
-
-
-
-
- Comment about the last transition
-
- python:state_change.kwargs.get('comment', '')
-
-
-
-
-
- Provides access to workflow history
-
- state_change/getHistory
-
-
- Request review
- Review portal content
-
-
-
- When the previous transition was performed
-
- state_change/getDateTime
-
-
-
-
-
diff --git a/src/collective/contact/core/upgrades/profiles/v6/types/held_position.xml b/src/collective/contact/core/upgrades/profiles/v6/types/held_position.xml
deleted file mode 100644
index 0d201c41..00000000
--- a/src/collective/contact/core/upgrades/profiles/v6/types/held_position.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
- view
- view
-
-
-
-
diff --git a/src/collective/contact/core/upgrades/profiles/v6/types/organization.xml b/src/collective/contact/core/upgrades/profiles/v6/types/organization.xml
deleted file mode 100644
index 2643e47c..00000000
--- a/src/collective/contact/core/upgrades/profiles/v6/types/organization.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
- view
- view
-
-
-
-
diff --git a/src/collective/contact/core/upgrades/profiles/v6/types/person.xml b/src/collective/contact/core/upgrades/profiles/v6/types/person.xml
deleted file mode 100644
index 406e6be8..00000000
--- a/src/collective/contact/core/upgrades/profiles/v6/types/person.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
- view
- view
-
-
-
-
diff --git a/src/collective/contact/core/upgrades/profiles/v6/types/position.xml b/src/collective/contact/core/upgrades/profiles/v6/types/position.xml
deleted file mode 100644
index 6c2e136c..00000000
--- a/src/collective/contact/core/upgrades/profiles/v6/types/position.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
- view
- view
-
-
-
-
diff --git a/src/collective/contact/core/upgrades/profiles/v7/registry.xml b/src/collective/contact/core/upgrades/profiles/v7/registry.xml
deleted file mode 100644
index 132a1f83..00000000
--- a/src/collective/contact/core/upgrades/profiles/v7/registry.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
- True
- False
- Use held positions to search persons
-
- True
-
-
-
- True
- False
- Use description to search persons
-
- True
-
-
diff --git a/src/collective/contact/core/upgrades/profiles/v8/registry.xml b/src/collective/contact/core/upgrades/profiles/v8/registry.xml
deleted file mode 100644
index 51806b50..00000000
--- a/src/collective/contact/core/upgrades/profiles/v8/registry.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
- True
- False
- Use description to search persons
-
- True
-
-
diff --git a/src/collective/contact/core/upgrades/profiles/v9/propertiestool.xml b/src/collective/contact/core/upgrades/profiles/v9/propertiestool.xml
deleted file mode 100644
index e6378bf5..00000000
--- a/src/collective/contact/core/upgrades/profiles/v9/propertiestool.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/collective/contact/core/upgrades/upgrades.py b/src/collective/contact/core/upgrades/upgrades.py
deleted file mode 100644
index be382146..00000000
--- a/src/collective/contact/core/upgrades/upgrades.py
+++ /dev/null
@@ -1,134 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from collective.contact.core.interfaces import IContactCoreParameters
-from collective.contact.core.interfaces import IHeldPosition
-from collective.contact.widget.interfaces import IContactContent
-from ecreall.helpers.upgrade.interfaces import IUpgradeTool
-from plone import api
-from Products.CMFPlone.utils import base_hasattr
-from z3c.relationfield.event import updateRelations
-from z3c.relationfield.interfaces import IHasRelations
-from zc.relation.interfaces import ICatalog
-from zope.component import getUtility
-
-
-def reindex_relations(context):
- """Clear the relation catalog to fix issues with interfaces that don't exist anymore.
- This actually fixes the from_interfaces_flattened and to_interfaces_flattened indexes.
- """
- rcatalog = getUtility(ICatalog)
- rcatalog.clear()
- catalog = api.portal.get_tool('portal_catalog')
- brains = catalog.searchResults(object_provides=IHasRelations.__identifier__)
- for brain in brains:
- obj = brain.getObject()
- updateRelations(obj, None)
-
-
-def v2(context):
- tool = IUpgradeTool(context)
- tool.runProfile('collective.contact.core.upgrades:v2')
- catalog = api.portal.get_tool(name='portal_catalog')
- catalog.clearFindAndRebuild()
- reindex_relations(context)
-
-
-def v3(context):
- catalog = api.portal.get_tool('portal_catalog')
- brains = catalog.unrestrictedSearchResults(object_provides=IContactContent.__identifier__)
- for brain in brains:
- obj = brain.getObject()
- obj.is_created = True
-
-
-def v4(context):
- IUpgradeTool(context).runImportStep('collective.contact.core', 'rolemap')
-
-
-def v5(context):
- tool = IUpgradeTool(context)
- tool.runProfile('collective.contact.widget:default')
- # add sortable_title column and reindex persons and organizations
- tool.addMetadata('sortable_title')
- tool.reindexContents(IContactContent, ('sortable_title',))
-
-
-def v6(context):
- tool = IUpgradeTool(context)
- tool.runProfile('collective.contact.core.upgrades:v6')
- tool.refreshResources()
-
-
-def v7(context):
- tool = IUpgradeTool(context)
- tool.runProfile('collective.contact.core.upgrades:v7')
-
-
-def v8(context):
- tool = IUpgradeTool(context)
- tool.runProfile('collective.contact.core.upgrades:v8')
-
-
-def v9(context):
- tool = IUpgradeTool(context)
- tool.runProfile('collective.contact.core.upgrades:v9')
-
-
-def v10(context):
- catalog = api.portal.get_tool('portal_catalog')
- brains = catalog.searchResults(object_provides=IHeldPosition.__identifier__)
- for brain in brains:
- brain.getObject().reindexObject(['start', 'end'])
-
-
-def v11(context):
- IUpgradeTool(context).runImportStep('collective.contact.core', 'typeinfo')
- IUpgradeTool(context).runImportStep('collective.contact.core', 'plone.app.registry')
- val = api.portal.get_registry_record(name='person_contact_details_private', interface=IContactCoreParameters)
- if val is None:
- api.portal.set_registry_record(name='person_contact_details_private', value=True,
- interface=IContactCoreParameters)
-
-
-def v12(context):
- IUpgradeTool(context).runImportStep('collective.contact.core', 'plone.app.registry')
- catalog = api.portal.get_tool('portal_catalog')
- brains = catalog.unrestrictedSearchResults(object_provides=IContactContent.__identifier__)
- for brain in brains:
- brain.getObject().reindexObject(['Title', 'sortable_title', 'get_full_title', 'SearchableText'])
-
-
-def v13(context):
- catalog = api.portal.get_tool('portal_catalog')
- brains = catalog.unrestrictedSearchResults(object_provides=IContactContent.__identifier__)
- for brain in brains:
- obj = brain.getObject()
- if base_hasattr(obj, 'is_created'):
- delattr(obj, 'is_created')
-
-
-def v15(context):
- tool = IUpgradeTool(context)
- tool.runImportStep('collective.contact.core', 'plone.app.registry')
- tool.runImportStep('collective.contact.core', 'catalog')
- tool.reindexContents(IContactContent, ('email',))
-
-
-def v16(context):
- tool = IUpgradeTool(context)
- tool.runImportStep('collective.contact.core', 'plone.app.registry')
- tool.runImportStep('collective.contact.core', 'catalog')
- tool.reindexContents(IContactContent, ('email', 'contact_source',))
-
-
-def v18(context):
- tool = IUpgradeTool(context)
- tool.runImportStep('collective.contact.core', 'typeinfo')
- tool.reindexContents(IContactContent, ('SearchableText',))
-
-
-def v20(context):
- catalog = api.portal.get_tool('portal_catalog')
- brains = catalog.unrestrictedSearchResults(object_provides=IContactContent.__identifier__)
- for brain in brains:
- brain.getObject().reindexObject(['email'])
diff --git a/src/collective/contact/core/vocabulary.py b/src/collective/contact/core/vocabularies.py
similarity index 83%
rename from src/collective/contact/core/vocabulary.py
rename to src/collective/contact/core/vocabularies.py
index 821f5c82..b91a2eab 100644
--- a/src/collective/contact/core/vocabulary.py
+++ b/src/collective/contact/core/vocabularies.py
@@ -1,7 +1,7 @@
from . import _
from Acquisition import aq_parent
-from five import grok
from zope.globalrequest import getRequest
+from zope.interface import implementer
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import SimpleVocabulary
@@ -32,9 +32,8 @@ def get_vocabulary(schema_list):
return SimpleVocabulary(terms)
-class PositionTypes(grok.GlobalUtility):
- grok.name("PositionTypes")
- grok.implements(IVocabularyFactory)
+@implementer(IVocabularyFactory)
+class PositionTypes(object):
def __call__(self, context):
try:
@@ -44,9 +43,11 @@ def __call__(self, context):
return SimpleVocabulary([])
-class OrganizationTypesOrLevels(grok.GlobalUtility):
- grok.name("OrganizationTypesOrLevels")
- grok.implements(IVocabularyFactory)
+PositionTypesFactory = PositionTypes()
+
+
+@implementer(IVocabularyFactory)
+class OrganizationTypesOrLevels(object):
def get_container_type(self, context):
request = getRequest()
@@ -70,14 +71,19 @@ def __call__(self, context):
return SimpleVocabulary([])
-class Genders(grok.GlobalUtility):
- grok.name("Genders")
- grok.implements(IVocabularyFactory)
+OrganizationTypesOrLevelsFactory = OrganizationTypesOrLevels()
+
+
+@implementer(IVocabularyFactory)
+class Genders(object):
def __call__(self, context):
terms = []
genders = {'M': _("Male"), 'F': _("Female")}
- for (token, value) in genders.iteritems():
+ for (token, value) in genders.items():
term = SimpleVocabulary.createTerm(token, token, value)
terms.append(term)
return SimpleVocabulary(terms)
+
+
+GendersFactory = Genders()
diff --git a/src/collective/contact/core/vocabularies.zcml b/src/collective/contact/core/vocabularies.zcml
new file mode 100644
index 00000000..42106597
--- /dev/null
+++ b/src/collective/contact/core/vocabularies.zcml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+