Skip to content

Commit

Permalink
Merge pull request #41 from eea/develop
Browse files Browse the repository at this point in the history
Fix other organisations metadata
  • Loading branch information
claudiaifrim authored Oct 4, 2024
2 parents d590b90 + 4645e34 commit 8aae704
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 64 deletions.
28 changes: 4 additions & 24 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
pipeline {
agent any
agent {
node { label 'docker-host' }
}

environment {
GIT_NAME = "eea.coremetadata"
Expand All @@ -13,35 +15,27 @@ pipeline {
parallel(

"JS Hint": {
node(label: 'docker') {
script {
sh '''docker run -i --rm --name="$BUILD_TAG-jshint" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/jshint'''
}
}
},

"CSS Lint": {
node(label: 'docker') {
script {
sh '''docker run -i --rm --name="$BUILD_TAG-csslint" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/csslint'''
}
}
},

"PEP8": {
node(label: 'docker') {
script {
sh '''docker run -i --rm --name="$BUILD_TAG-pep8" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/pep8'''
}
}
},

"PyLint": {
node(label: 'docker') {
script {
sh '''docker run -i --rm --name="$BUILD_TAG-pylint" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/pylint'''
}
}
}

)
Expand All @@ -53,28 +47,20 @@ pipeline {
parallel(

"ZPT Lint": {
node(label: 'docker') {
sh '''docker run -i --rm --name="$BUILD_TAG-zptlint" -e GIT_BRANCH="$BRANCH_NAME" -e ADDONS="$GIT_NAME" -e DEVELOP="src/$GIT_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plone-test:4 zptlint'''
}
},

"JS Lint": {
node(label: 'docker') {
sh '''docker run -i --rm --name="$BUILD_TAG-jslint" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/jslint4java'''
}
},

"PyFlakes": {
node(label: 'docker') {
sh '''docker run -i --rm --name="$BUILD_TAG-pyflakes" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/pyflakes'''
}
},

"i18n": {
node(label: 'docker') {
sh '''docker run -i --rm --name=$BUILD_TAG-i18n -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/i18ndude'''
}
}
}
)
}
}
Expand Down Expand Up @@ -107,9 +93,7 @@ pipeline {
// },

"Python3": {
node(label: 'docker') {
sh '''docker run -i --rm --name="$BUILD_TAG-python3" -e GIT_BRANCH="$BRANCH_NAME" -e ADDONS="$GIT_NAME" -e DEVELOP="src/$GIT_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plone-test:5-python3 -v -vv -s $GIT_NAME'''
}
}
)
}
Expand Down Expand Up @@ -150,7 +134,6 @@ pipeline {
environment name: 'CHANGE_TARGET', value: 'master'
}
steps {
node(label: 'docker') {
script {
if ( env.CHANGE_BRANCH != "develop" && !( env.CHANGE_BRANCH.startsWith("hotfix")) ) {
error "Pipeline aborted due to PR not made from develop or hotfix branch"
Expand All @@ -159,7 +142,6 @@ pipeline {
sh '''docker pull eeacms/gitflow'''
sh '''docker run -i --rm --name="$BUILD_TAG-gitflow-pr" -e GIT_CHANGE_BRANCH="$CHANGE_BRANCH" -e GIT_CHANGE_AUTHOR="$CHANGE_AUTHOR" -e GIT_CHANGE_TITLE="$CHANGE_TITLE" -e GIT_TOKEN="$GITHUB_TOKEN" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e GIT_ORG="$GIT_ORG" -e GIT_NAME="$GIT_NAME" eeacms/gitflow'''
}
}
}
}
}
Expand All @@ -172,11 +154,9 @@ pipeline {
}
}
steps {
node(label: 'docker') {
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'eea-jenkins', usernameVariable: 'EGGREPO_USERNAME', passwordVariable: 'EGGREPO_PASSWORD'],string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN'),[$class: 'UsernamePasswordMultiBinding', credentialsId: 'pypi-jenkins', usernameVariable: 'PYPI_USERNAME', passwordVariable: 'PYPI_PASSWORD']]) {
sh '''docker pull eeacms/gitflow'''
sh '''docker run -i --rm --name="$BUILD_TAG-gitflow-master" -e GIT_BRANCH="$BRANCH_NAME" -e EGGREPO_USERNAME="$EGGREPO_USERNAME" -e EGGREPO_PASSWORD="$EGGREPO_PASSWORD" -e GIT_NAME="$GIT_NAME" -e PYPI_USERNAME="$PYPI_USERNAME" -e PYPI_PASSWORD="$PYPI_PASSWORD" -e GIT_ORG="$GIT_ORG" -e GIT_TOKEN="$GITHUB_TOKEN" eeacms/gitflow'''
}
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions docs/HISTORY.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

4.3 - (2024-10-01)
---------------------------
* Change: Fix other organisations metadata
[avoinea]

4.2 - (2024-07-29)
---------------------------
* Change: Cleanup code comments and pdb
Expand Down
37 changes: 14 additions & 23 deletions eea/coremetadata/configure.zcml
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:zcml="http://namespaces.zope.org/zcml"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
xmlns:five="http://namespaces.zope.org/five"
xmlns:i18n="http://namespaces.zope.org/i18n"
i18n_domain="eea">
<configure xmlns="http://namespaces.zope.org/zope"
xmlns:zcml="http://namespaces.zope.org/zcml"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
xmlns:five="http://namespaces.zope.org/five"
xmlns:i18n="http://namespaces.zope.org/i18n" i18n_domain="eea">

<i18n:registerTranslations directory="locales" />
<i18n:registerTranslations directory="locales" />

<include file="profiles.zcml" />
<include package=".browser" />
<include package=".behaviors" />
<include package=".upgrades" />
<include file="profiles.zcml" />
<include package=".browser" />
<include package=".behaviors" />
<include package=".upgrades" />

<adapter factory=".indexer.temporal_coverage_indexer" name="temporal_coverage" />
<adapter factory=".indexer.data_provenance_indexer" name="data_provenance" />
<adapter factory=".indexer.temporal_coverage_indexer" name="temporal_coverage" />
<adapter factory=".indexer.data_provenance_indexer" name="data_provenance" />

<utility
name="eea.coremetadata.other_organisations"
component=".vocabulary.OtherOrganisationsVocabularyFactory"
/>
<utility
factory=".index_modifiers.OtherOrganisations"
provides="plone.app.querystring.interfaces.IParsedQueryIndexModifier"
name="taxonomy_eeaorganisationstaxonomy"
/>
<utility name="eea.coremetadata.other_organisations" component=".vocabulary.OtherOrganisationsVocabularyFactory" />
<!-- <utility factory=".index_modifiers.OtherOrganisations" provides="plone.app.querystring.interfaces.IParsedQueryIndexModifier" name="taxonomy_eeaorganisationstaxonomy" /> -->
</configure>
18 changes: 3 additions & 15 deletions eea/coremetadata/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@
from z3c.form.browser.select import SelectFieldWidget
from Products.CMFCore.permissions import ModifyPortalContent, View

has_ajax_widget = True
AjaxSelectFieldWidget = None
try:
from plone.app.z3cform.widgets.select import AjaxSelectFieldWidget
except ImportError:
has_ajax_widget = False

_marker = []
_zone = DateTime().timezone()
Expand Down Expand Up @@ -180,7 +174,9 @@ class ICoreMetadata(model.Schema):
directives.no_omit(IEditForm, "effective", "expires")
directives.no_omit(IAddForm, "effective", "expires")

directives.widget("other_organisations", SelectFieldWidget)
directives.widget("other_organisations",
vocabulary="eea.coremetadata.other_organisations")

other_organisations = Tuple(
title=_("Other organisations involved"),
description=_(
Expand All @@ -192,14 +188,6 @@ class ICoreMetadata(model.Schema):
missing_value=(),
default=tuple()
)

if has_ajax_widget:
directives.widget(
"other_organisations",
AjaxSelectFieldWidget,
vocabulary="eea.coremetadata.other_organisations"
)

directives.widget("topics", SelectFieldWidget)
topics = Tuple(
title=_("Topics"),
Expand Down
2 changes: 1 addition & 1 deletion eea/coremetadata/profiles/default/catalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<indexed_attr value="data_provenance"/>
</index>

<column value="taxonomy_eeaorganisationstaxonomy" />
<column value="other_organisations" />
<column value="taxonomy_eeapublishertaxonomy" />
<column value="taxonomy_eeatopicstaxonomy" />
<column value="temporal_coverage" />
Expand Down
9 changes: 9 additions & 0 deletions eea/coremetadata/upgrades/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,13 @@
profile="eea.coremetadata:default"
/>

<genericsetup:upgradeStep
title="Remove EEA Coremetadata Organisations taxonomy behavior and indexer"
description=""
source="4.0"
destination="5.0"
handler=".to_50.to_50"
profile="eea.coremetadata:default"
/>

</configure>
24 changes: 24 additions & 0 deletions eea/coremetadata/upgrades/to_50.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

""" Upgrade to 5.0 """
from zope.configuration.name import resolve


def to_50(context):
""" Remove EEA Coremetadata Organisations taxonomy behavior and indexer """
sm = context.aq_parent.getSiteManager()

# Remove Adapter other_organisations indexer
required = [resolve('plone.dexterity.interfaces.IDexterityContent'),
resolve('Products.ZCatalog.interfaces.IZCatalog')]
provided = resolve('plone.indexer.interfaces.IIndexer')
name = 'other_organisations'
sm.adapters.unregister(required=required, provided=provided, name=name)

# Remove Utility other_organisations behavior
provided = resolve('plone.behavior.interfaces.IBehavior')
name = 'other_organisations'
ofs_id = 'plone.behavior.interfaces.IBehavior-other_organisations'
if ofs_id in sm.objectIds():
sm._delObject(ofs_id, suppress_events=True)

sm.unregisterUtility(provided=provided, name=name)
2 changes: 1 addition & 1 deletion eea/coremetadata/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2
4.3

0 comments on commit 8aae704

Please sign in to comment.