-
Notifications
You must be signed in to change notification settings - Fork 0
URB-3595: Add dematerialized encoding warning on NOTICE folder #561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.9.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Add dematerialized encoding warning on NOTICE folder | ||
| [WBoudabous] |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,6 +9,9 @@ | |||||||||||||||||||||||||||||||||||||
| from Products.urban.contentrules.notice import INoticeImportSucceededEvent | ||||||||||||||||||||||||||||||||||||||
| from Products.urban.contentrules.notice import INoticeResponseFailedEvent | ||||||||||||||||||||||||||||||||||||||
| from Products.urban.contentrules.utils import ContentRulesUtils | ||||||||||||||||||||||||||||||||||||||
| from Products.urban.interfaces import IGenericLicence | ||||||||||||||||||||||||||||||||||||||
| from Products.urban.interfaces import ILicenceCreatedViaNoticeWS | ||||||||||||||||||||||||||||||||||||||
| from Products.urban.interfaces import IUrbanEventNotice | ||||||||||||||||||||||||||||||||||||||
| from Products.urban.migration.utils import cook_javascript_resources | ||||||||||||||||||||||||||||||||||||||
| from Products.urban.setuphandlers import add_new_urban_licence_type | ||||||||||||||||||||||||||||||||||||||
| from Products.urban.utils import moveElementAfter | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -20,8 +23,11 @@ | |||||||||||||||||||||||||||||||||||||
| from plone.registry import field | ||||||||||||||||||||||||||||||||||||||
| from plone.registry import Record | ||||||||||||||||||||||||||||||||||||||
| from plone.registry.interfaces import IRegistry | ||||||||||||||||||||||||||||||||||||||
| from zope.annotation.interfaces import IAnnotations | ||||||||||||||||||||||||||||||||||||||
| from zope.component import getUtility | ||||||||||||||||||||||||||||||||||||||
| from zope.event import notify | ||||||||||||||||||||||||||||||||||||||
| from zope.i18n import translate | ||||||||||||||||||||||||||||||||||||||
| from zope.interface import alsoProvides | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| import logging | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
|
|
@@ -721,3 +727,37 @@ def setup_referenceFT_PM(context): | |||||||||||||||||||||||||||||||||||||
| reindexIndexes(None, ["referenceFT_PM"]) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| logger.info("upgrade step done!") | ||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing blank lines |
||||||||||||||||||||||||||||||||||||||
| def add_notice_warning(context): | ||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method should also add the interface mentioned for
Comment on lines
729
to
+730
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Add two blank lines before Line 730 follows line 729 with no separation. This breaks PEP8 E302 and repeats an earlier reviewer comment on line 729. Proposed fix logger.info("upgrade step done!")
+
+
def add_notice_warning(context):🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||
| Add notice warning on portal_urban warnings field. | ||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||
| logger = logging.getLogger("urban: Add notice warning") | ||||||||||||||||||||||||||||||||||||||
| logger.info("starting upgrade steps") | ||||||||||||||||||||||||||||||||||||||
| portal_urban = api.portal.get_tool("portal_urban") | ||||||||||||||||||||||||||||||||||||||
| existing = list(portal_urban.getWarnings()) | ||||||||||||||||||||||||||||||||||||||
| names = [w["condition"] for w in existing] | ||||||||||||||||||||||||||||||||||||||
| if "urban.warnings.notice" not in names: | ||||||||||||||||||||||||||||||||||||||
| existing.append( | ||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||
| "condition": "urban.warnings.notice", | ||||||||||||||||||||||||||||||||||||||
| "level": "warning", | ||||||||||||||||||||||||||||||||||||||
| "message": translate( | ||||||||||||||||||||||||||||||||||||||
| "urban.warnings.notice", | ||||||||||||||||||||||||||||||||||||||
| domain="urban", | ||||||||||||||||||||||||||||||||||||||
| target_language="fr", | ||||||||||||||||||||||||||||||||||||||
| default=u"Ce dossier a été encodé de manière dématérialisée", | ||||||||||||||||||||||||||||||||||||||
| ).encode("utf-8"), | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||
| portal_urban.setWarnings(tuple(existing)) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| catalog = api.portal.get_tool("portal_catalog") | ||||||||||||||||||||||||||||||||||||||
| licence_brains = catalog(object_provides=IGenericLicence.__identifier__) | ||||||||||||||||||||||||||||||||||||||
| for licence_brain in licence_brains: | ||||||||||||||||||||||||||||||||||||||
| licence = licence_brain.getObject() | ||||||||||||||||||||||||||||||||||||||
| for event in licence.getAllEvents(IUrbanEventNotice): | ||||||||||||||||||||||||||||||||||||||
| if IAnnotations(event).get("notice_notification", {}): | ||||||||||||||||||||||||||||||||||||||
| alsoProvides(licence, ILicenceCreatedViaNoticeWS) | ||||||||||||||||||||||||||||||||||||||
| break | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+754
to
+761
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Reindex The migration applies the marker but never reindexes the licence. Also set Proposed fix for event in licence.getAllEvents(IUrbanEventNotice):
if IAnnotations(event).get("notice_notification", {}):
alsoProvides(licence, ILicenceCreatedViaNoticeWS)
+ licence._p_changed = 1
+ licence.reindexObject(idxs=["object_provides"])
break📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| logger.info("upgrade done!") | ||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong indent