--- a/src/pyams_content/component/association/__init__.py Wed Jun 13 08:55:06 2018 +0200
+++ b/src/pyams_content/component/association/__init__.py Wed Jun 13 08:56:05 2018 +0200
@@ -16,7 +16,7 @@
# import standard library
# import interfaces
-from pyams_content.component.association.interfaces import IAssociationItem, IAssociationTarget
+from pyams_content.component.association.interfaces import IAssociationItem, IAssociationContainerTarget
from pyams_form.interfaces.form import IFormContextPermissionChecker
from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent, IObjectRemovedEvent
@@ -52,14 +52,14 @@
@property
def edit_permission(self):
- content = get_parent(self.context, IAssociationTarget)
+ content = get_parent(self.context, IAssociationContainerTarget)
return IFormContextPermissionChecker(content).edit_permission
@subscriber(IObjectAddedEvent, context_selector=IAssociationItem)
def handle_added_association(event):
"""Handle added association item"""
- content = get_parent(event.object, IAssociationTarget)
+ content = get_parent(event.object, IAssociationContainerTarget)
if content is not None:
get_current_registry().notify(ObjectModifiedEvent(content))
@@ -67,7 +67,7 @@
@subscriber(IObjectModifiedEvent, context_selector=IAssociationItem)
def handle_modified_association(event):
"""Handle modified association item"""
- content = get_parent(event.object, IAssociationTarget)
+ content = get_parent(event.object, IAssociationContainerTarget)
if content is not None:
get_current_registry().notify(ObjectModifiedEvent(content))
@@ -75,6 +75,6 @@
@subscriber(IObjectRemovedEvent, context_selector=IAssociationItem)
def handle_removed_association(event):
"""Handle removed association item"""
- content = get_parent(event.object, IAssociationTarget)
+ content = get_parent(event.object, IAssociationContainerTarget)
if content is not None:
get_current_registry().notify(ObjectModifiedEvent(content))
--- a/src/pyams_content/component/association/container.py Wed Jun 13 08:55:06 2018 +0200
+++ b/src/pyams_content/component/association/container.py Wed Jun 13 08:56:05 2018 +0200
@@ -16,7 +16,7 @@
# import standard library
# import interfaces
-from pyams_content.component.association.interfaces import IAssociationContainer, IAssociationTarget, \
+from pyams_content.component.association.interfaces import IAssociationContainer, IAssociationContainerTarget, \
ASSOCIATION_CONTAINER_KEY, IAssociationItem, IAssociationInfo
from pyams_content.features.checker.interfaces import IContentChecker
from zope.location.interfaces import ISublocations
@@ -58,13 +58,13 @@
return filter(lambda x: IAssociationItem(x).visible, self.values())
-@adapter_config(context=IAssociationTarget, provides=IAssociationContainer)
+@adapter_config(context=IAssociationContainerTarget, provides=IAssociationContainer)
def association_container_factory(target):
"""Associations container factory"""
return get_annotation_adapter(target, ASSOCIATION_CONTAINER_KEY, AssociationContainer, name='++ass++')
-@adapter_config(name='ass', context=IAssociationTarget, provides=ITraversable)
+@adapter_config(name='ass', context=IAssociationContainerTarget, provides=ITraversable)
class AssociationContainerNamespace(ContextAdapter):
"""Associations container ++ass++ namespace"""
@@ -73,7 +73,7 @@
return registry.queryAdapter(self.context, IAssociationContainer, name=name or '')
-@adapter_config(name='associations', context=IAssociationTarget, provides=ISublocations)
+@adapter_config(name='associations', context=IAssociationContainerTarget, provides=ISublocations)
class AssociationContainerSublocations(ContextAdapter):
"""Associations container sub-locations adapter"""
@@ -81,7 +81,7 @@
return IAssociationContainer(self.context).values()
-@adapter_config(name='associations', context=IAssociationTarget, provides=IContentChecker)
+@adapter_config(name='associations', context=IAssociationContainerTarget, provides=IContentChecker)
class AssociationsContentChecker(BaseContentChecker):
"""Associations content checker"""
@@ -110,7 +110,7 @@
def __init__(self, context=None):
terms = []
- target = get_parent(context, IAssociationTarget)
+ target = get_parent(context, IAssociationContainerTarget)
if target is not None:
terms = [SimpleTerm(link.__name__, title=IAssociationInfo(link).inner_title)
for link in IAssociationContainer(target).values()]
--- a/src/pyams_content/component/association/interfaces/__init__.py Wed Jun 13 08:55:06 2018 +0200
+++ b/src/pyams_content/component/association/interfaces/__init__.py Wed Jun 13 08:56:05 2018 +0200
@@ -74,7 +74,7 @@
"""Get list of visible items"""
-class IAssociationTarget(IAttributeAnnotatable):
+class IAssociationContainerTarget(IAttributeAnnotatable):
"""Associations container target interface"""
@@ -82,6 +82,10 @@
"""Association renderer adapter interface"""
+#
+# Associations paragraph
+#
+
ASSOCIATION_PARAGRAPH_TYPE = 'Associations'
ASSOCIATION_PARAGRAPH_NAME = _("Associations")
ASSOCIATION_PARAGRAPH_RENDERERS = 'PyAMS.associations.renderers'
--- a/src/pyams_content/component/association/zmi/__init__.py Wed Jun 13 08:55:06 2018 +0200
+++ b/src/pyams_content/component/association/zmi/__init__.py Wed Jun 13 08:56:05 2018 +0200
@@ -17,7 +17,8 @@
import json
# import interfaces
-from pyams_content.component.association.interfaces import IAssociationTarget, IAssociationContainer, IAssociationInfo
+from pyams_content.component.association.interfaces import IAssociationContainerTarget, IAssociationContainer, \
+ IAssociationInfo
from pyams_content.component.association.zmi.interfaces import IAssociationsParentForm, IAssociationsView
from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
from pyams_form.interfaces.form import IInnerSubForm
@@ -73,7 +74,7 @@
"""Association item properties edit form, JSON renderer"""
def get_associations_table(self):
- target = get_parent(self.context, IAssociationTarget)
+ target = get_parent(self.context, IAssociationContainerTarget)
return {
'status': 'success',
'message': self.request.localizer.translate(self.successMessage),
@@ -87,7 +88,7 @@
# Content associations view
#
-@viewlet_config(name='associations.menu', context=IAssociationTarget, layer=IPyAMSLayer,
+@viewlet_config(name='associations.menu', context=IAssociationContainerTarget, layer=IPyAMSLayer,
manager=IPropertiesMenu, permission=VIEW_SYSTEM_PERMISSION, weight=60)
class AssociationsMenu(MenuItem):
"""Associations menu"""
@@ -117,7 +118,7 @@
@property
def data_attributes(self):
registry = get_current_registry()
- target = get_parent(self.context, IAssociationTarget)
+ target = get_parent(self.context, IAssociationContainerTarget)
container = registry.getAdapter(target, IAssociationContainer, name=self.associations_name)
attributes = super(AssociationsTable, self).data_attributes
attributes['table'] = {
@@ -134,7 +135,7 @@
return list(super(AssociationsTable, self).values)
-@adapter_config(context=(IAssociationTarget, IPyAMSLayer, AssociationsTable), provides=IValues)
+@adapter_config(context=(IAssociationContainerTarget, IPyAMSLayer, AssociationsTable), provides=IValues)
class AssociationsTableValuesAdapter(ContextRequestViewAdapter):
"""Associations table values adapter"""
@@ -144,7 +145,7 @@
return registry.getAdapter(self.context, IAssociationContainer, name=self.view.associations_name).values()
-@adapter_config(name='sorter', context=(IAssociationTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
+@adapter_config(name='sorter', context=(IAssociationContainerTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
@adapter_config(name='sorter', context=(IAssociationContainer, IPyAMSLayer, AssociationsTable), provides=IColumn)
class AssociationsTableSorterColumn(ProtectedFormObjectMixin, SorterColumn):
"""Associations table sorter column"""
@@ -159,7 +160,7 @@
return {'status': 'success'}
-@adapter_config(name='show-hide', context=(IAssociationTarget, IPyAMSLayer, AssociationsTable),
+@adapter_config(name='show-hide', context=(IAssociationContainerTarget, IPyAMSLayer, AssociationsTable),
provides=IColumn)
@adapter_config(name='show-hide', context=(IAssociationContainer, IPyAMSLayer, AssociationsTable),
provides=IColumn)
@@ -174,7 +175,7 @@
return switch_element_visibility(request, IAssociationContainer)
-@adapter_config(name='pictogram', context=(IAssociationTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
+@adapter_config(name='pictogram', context=(IAssociationContainerTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
@adapter_config(name='pictogram', context=(IAssociationContainer, IPyAMSLayer, AssociationsTable), provides=IColumn)
class AssociationsTablePictogramColumn(ImageColumn):
"""Associations table pictogram column"""
@@ -190,7 +191,7 @@
return self.request.localizer.translate(item.icon_hint)
-@adapter_config(name='name', context=(IAssociationTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
+@adapter_config(name='name', context=(IAssociationContainerTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
@adapter_config(name='name', context=(IAssociationContainer, IPyAMSLayer, AssociationsTable), provides=IColumn)
class AssociationsTablePublicNameColumn(NameColumn):
"""Associations table name column"""
@@ -208,7 +209,7 @@
return title
-@adapter_config(name='inner_name', context=(IAssociationTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
+@adapter_config(name='inner_name', context=(IAssociationContainerTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
@adapter_config(name='inner_name', context=(IAssociationContainer, IPyAMSLayer, AssociationsTable), provides=IColumn)
class AssociationsTableInnerNameColumn(I18nColumn, GetAttrColumn):
"""Associations table inner name column"""
@@ -224,7 +225,7 @@
return '--'
-@adapter_config(name='size', context=(IAssociationTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
+@adapter_config(name='size', context=(IAssociationContainerTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
@adapter_config(name='size', context=(IAssociationContainer, IPyAMSLayer, AssociationsTable), provides=IColumn)
class AssociationsTableSizeColumn(I18nColumn, GetAttrColumn):
"""Associations table size column"""
@@ -240,7 +241,7 @@
return '--'
-@adapter_config(name='trash', context=(IAssociationTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
+@adapter_config(name='trash', context=(IAssociationContainerTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
@adapter_config(name='trash', context=(IAssociationContainer, IPyAMSLayer, AssociationsTable), provides=IColumn)
class AssociationsTableTrashColumn(ProtectedFormObjectMixin, TrashColumn):
"""Associations table trash column"""
@@ -253,7 +254,7 @@
output = delete_container_element(request)
if output.get('status') == 'success':
from pyams_content.component.paragraph.zmi import get_json_paragraph_toolbar_refresh_event
- parent = get_parent(request.context, IAssociationTarget)
+ parent = get_parent(request.context, IAssociationContainerTarget)
output.update({
'handle_json': True,
'events': [
@@ -264,7 +265,7 @@
return output
-@pagelet_config(name='associations.html', context=IAssociationTarget, layer=IPyAMSLayer,
+@pagelet_config(name='associations.html', context=IAssociationContainerTarget, layer=IPyAMSLayer,
permission=VIEW_SYSTEM_PERMISSION)
@implementer(IAssociationsView)
class AssociationsContainerView(ContainerAdminView, Pagelet):
@@ -274,7 +275,7 @@
table_class = AssociationsTable
-@pagelet_config(name='associations-dialog.html', context=IAssociationTarget, layer=IPyAMSLayer,
+@pagelet_config(name='associations-dialog.html', context=IAssociationContainerTarget, layer=IPyAMSLayer,
permission=VIEW_SYSTEM_PERMISSION)
@implementer(IAssociationsParentForm)
class AssociationsContainerDialogView(AdminDialogDisplayForm):
@@ -287,7 +288,7 @@
fields = field.Fields(Interface)
-@adapter_config(name='associations', context=(IAssociationTarget, IPyAMSLayer, IAssociationsParentForm),
+@adapter_config(name='associations', context=(IAssociationContainerTarget, IPyAMSLayer, IAssociationsParentForm),
provides=IInnerSubForm)
@implementer(IAssociationsView)
class AssociationsView(InnerTableView):
--- a/src/pyams_content/component/extfile/interfaces/__init__.py Wed Jun 13 08:55:06 2018 +0200
+++ b/src/pyams_content/component/extfile/interfaces/__init__.py Wed Jun 13 08:56:05 2018 +0200
@@ -16,7 +16,7 @@
# import standard library
# import interfaces
-from pyams_content.component.association.interfaces import IAssociationItem, IAssociationTarget
+from pyams_content.component.association.interfaces import IAssociationItem, IAssociationContainerTarget
# import packages
from pyams_i18n.schema import I18nTextLineField, I18nTextField, I18nFileField, I18nThumbnailImageField, \
@@ -91,5 +91,5 @@
required=True)
-class IExtFileContainerTarget(IAssociationTarget):
+class IExtFileContainerTarget(IAssociationContainerTarget):
"""External files container marker interface"""
--- a/src/pyams_content/component/extfile/zmi/container.py Wed Jun 13 08:55:06 2018 +0200
+++ b/src/pyams_content/component/extfile/zmi/container.py Wed Jun 13 08:56:05 2018 +0200
@@ -16,7 +16,8 @@
# import standard library
# import interfaces
-from pyams_content.component.association.interfaces import IAssociationTarget, IAssociationContainer, IAssociationInfo
+from pyams_content.component.association.interfaces import IAssociationContainerTarget, IAssociationContainer, \
+ IAssociationInfo
from pyams_content.component.extfile.interfaces import IExtFile, IExtImage
from pyams_i18n.interfaces import II18n
from pyams_skin.layer import IPyAMSLayer
@@ -37,7 +38,7 @@
def get_files_list(request):
"""Get container files in JSON format for TinyMCE editor"""
result = []
- target = get_parent(request.context, IAssociationTarget)
+ target = get_parent(request.context, IAssociationContainerTarget)
if target is not None:
container = IAssociationContainer(target)
result.extend([{'title': IAssociationInfo(item).user_title,
@@ -52,7 +53,7 @@
def get_images_list(request):
"""Get container images in JSON format for TinyMCE editor"""
result = []
- target = get_parent(request.context, IAssociationTarget)
+ target = get_parent(request.context, IAssociationContainerTarget)
if target is not None:
container = IAssociationContainer(target)
result.extend([{'title': IAssociationInfo(item).user_title,
--- a/src/pyams_content/component/links/__init__.py Wed Jun 13 08:55:06 2018 +0200
+++ b/src/pyams_content/component/links/__init__.py Wed Jun 13 08:56:05 2018 +0200
@@ -16,7 +16,7 @@
# import standard library
# import interfaces
-from pyams_content.component.association.interfaces import IAssociationInfo, IAssociationTarget, IAssociationContainer
+from pyams_content.component.association.interfaces import IAssociationInfo, IAssociationContainerTarget, IAssociationContainer
from pyams_content.component.links.interfaces import IBaseLink, IInternalLink, IExternalLink, IMailtoLink
from pyams_content.features.checker.interfaces import IContentChecker, ERROR_VALUE
from pyams_content.interfaces import IBaseContent, MANAGE_CONTENT_PERMISSION
@@ -55,7 +55,7 @@
def __init__(self, context=None):
terms = []
- target = get_parent(context, IAssociationTarget)
+ target = get_parent(context, IAssociationContainerTarget)
if target is not None:
terms = [SimpleTerm(link.__name__, title=IAssociationInfo(link).inner_title)
for link in IAssociationContainer(target).values() if IBaseLink.providedBy(link)]
--- a/src/pyams_content/component/links/interfaces/__init__.py Wed Jun 13 08:55:06 2018 +0200
+++ b/src/pyams_content/component/links/interfaces/__init__.py Wed Jun 13 08:56:05 2018 +0200
@@ -16,7 +16,7 @@
# import standard library
# import interfaces
-from pyams_content.component.association.interfaces import IAssociationTarget, IAssociationItem
+from pyams_content.component.association.interfaces import IAssociationContainerTarget, IAssociationItem
from pyams_content.reference.pictograms.interfaces import SELECTED_PICTOGRAM_VOCABULARY
from pyams_sequence.interfaces import IInternalReference
@@ -83,5 +83,5 @@
required=True)
-class ILinkContainerTarget(IAssociationTarget):
+class ILinkContainerTarget(IAssociationContainerTarget):
"""Links container marker interface"""
--- a/src/pyams_content/component/links/zmi/container.py Wed Jun 13 08:55:06 2018 +0200
+++ b/src/pyams_content/component/links/zmi/container.py Wed Jun 13 08:56:05 2018 +0200
@@ -16,7 +16,7 @@
# import standard library
# import interfaces
-from pyams_content.component.association.interfaces import IAssociationContainer, IAssociationTarget, IAssociationInfo
+from pyams_content.component.association.interfaces import IAssociationContainer, IAssociationContainerTarget, IAssociationInfo
from pyams_content.component.extfile.interfaces import IBaseExtFile
from pyams_content.component.links.interfaces import IBaseLink
from pyams_i18n.interfaces import II18n
@@ -40,7 +40,7 @@
result = []
key_field_name = request.params.get('keyFieldName', 'title')
value_field_name = request.params.get('valueFieldName', 'value')
- target = get_parent(request.context, IAssociationTarget)
+ target = get_parent(request.context, IAssociationContainerTarget)
if target is not None:
container = IAssociationContainer(target)
result.extend([{key_field_name: item.__name__,
@@ -54,7 +54,7 @@
def get_links_list(request):
"""Get links list in JSON format for TinyMCE editor"""
result = []
- target = get_parent(request.context, IAssociationTarget)
+ target = get_parent(request.context, IAssociationContainerTarget)
if target is not None:
container = IAssociationContainer(target)
for item in container.values():
--- a/src/pyams_content/component/paragraph/zmi/frame.py Wed Jun 13 08:55:06 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/frame.py Wed Jun 13 08:56:05 2018 +0200
@@ -16,7 +16,7 @@
# import standard library
# import interfaces
-from pyams_content.component.association.interfaces import IAssociationTarget
+from pyams_content.component.association.interfaces import IAssociationContainerTarget
from pyams_content.component.association.zmi.interfaces import IAssociationsParentForm
from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer
from pyams_content.component.paragraph.interfaces.frame import IFrameParagraph, FRAME_PARAGRAPH_TYPE
@@ -150,7 +150,7 @@
output = super(self.__class__, self).get_ajax_output(changes)
if 'body' in changes.get(IFrameParagraph, ()):
# refresh associations count markers
- parent = get_parent(self.context, IAssociationTarget)
+ parent = get_parent(self.context, IAssociationContainerTarget)
output.setdefault('events', []).append(
get_json_paragraph_toolbar_refresh_event(parent, self.request,
ParagraphContainerTable, ParagraphTitleToolbarViewletManager))
--- a/src/pyams_content/component/paragraph/zmi/html.py Wed Jun 13 08:55:06 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/html.py Wed Jun 13 08:56:05 2018 +0200
@@ -16,7 +16,7 @@
# import standard library
# import interfaces
-from pyams_content.component.association.interfaces import IAssociationTarget
+from pyams_content.component.association.interfaces import IAssociationContainerTarget
from pyams_content.component.association.zmi.interfaces import IAssociationsParentForm
from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphFactorySettings, \
IParagraphContainer
@@ -223,7 +223,7 @@
output = super(self.__class__, self).get_ajax_output(changes)
if 'body' in changes.get(IHTMLParagraph, ()):
# refresh associations count markers
- parent = get_parent(self.context, IAssociationTarget)
+ parent = get_parent(self.context, IAssociationContainerTarget)
output.setdefault('events', []).append(
get_json_paragraph_toolbar_refresh_event(parent, self.request))
# refresh associations table
@@ -252,7 +252,7 @@
output = super(self.__class__, self).get_ajax_output(changes)
if 'body' in changes.get(IHTMLParagraph, ()):
# refresh associations count markers
- parent = get_parent(self.context, IAssociationTarget)
+ parent = get_parent(self.context, IAssociationContainerTarget)
output.setdefault('events', []).append(
get_json_paragraph_toolbar_refresh_event(parent, self.request))
# refresh associations table