Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
erp5
Commits
8546f2f4
Commit
8546f2f4
authored
Jan 11, 2023
by
Cédric Le Ninivin
Committed by
Cédric Le Ninivin
Mar 01, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_api_style: Add alarm to check consistency of jio_api_revision documents
parent
f4c47fc0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
320 additions
and
0 deletions
+320
-0
bt5/erp5_api_style/MixinTemplateItem/portal_components/mixin.erp5.JIOAPIRevisionMixin.py
...eItem/portal_components/mixin.erp5.JIOAPIRevisionMixin.py
+16
-0
bt5/erp5_api_style/PathTemplateItem/portal_alarms/jio_api_revision_check_consistency.xml
...Item/portal_alarms/jio_api_revision_check_consistency.xml
+208
-0
bt5/erp5_api_style/SkinTemplateItem/portal_skins/erp5_api_jio_sql_revision/Alarm_activateCheckAndFixUnmatchingJIOAPIRevisionHash.py
.../Alarm_activateCheckAndFixUnmatchingJIOAPIRevisionHash.py
+33
-0
bt5/erp5_api_style/SkinTemplateItem/portal_skins/erp5_api_jio_sql_revision/Alarm_activateCheckAndFixUnmatchingJIOAPIRevisionHash.xml
...Alarm_activateCheckAndFixUnmatchingJIOAPIRevisionHash.xml
+62
-0
bt5/erp5_api_style/bt/template_path_list
bt5/erp5_api_style/bt/template_path_list
+1
-0
No files found.
bt5/erp5_api_style/MixinTemplateItem/portal_components/mixin.erp5.JIOAPIRevisionMixin.py
View file @
8546f2f4
...
...
@@ -101,6 +101,22 @@ class JIOAPIRevisionMixin:
)
return
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'markUnmatchingJIOAPIrevisionHash'
)
def
markUnmatchingJIOAPIrevisionHash
(
self
):
"""
Check if the calculated hash match the stored one.
If not set jio_api_revision timestamp to 0 to triger reprocessing by alarm
"""
calculated_hash
=
self
.
_calculateHash
()
_
,
stored_hash
,
_
=
self
.
_getJIOAPIRevisionTuple
()
if
calculated_hash
!=
stored_hash
:
# Marking jIO API revision timestamp to zero will trigger reprocessing
self
.
Base_zUpdateTimeStampjIOAPIRevisionTable
(
uid
=
self
.
getUid
(),
indexation_timestamp
=
0
,
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'checkJIOAPIRevisionConstraint'
)
def
checkJIOAPIRevisionConstraint
(
self
,
**
kw
):
...
...
bt5/erp5_api_style/PathTemplateItem/portal_alarms/jio_api_revision_check_consistency.xml
0 → 100644
View file @
8546f2f4
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Alarm"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_local_properties
</string>
</key>
<value>
<tuple>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
configuration_form_id
</string>
</value>
</item>
<item>
<key>
<string>
type
</string>
</key>
<value>
<string>
string
</string>
</value>
</item>
</dictionary>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
catalog_query_string
</string>
</value>
</item>
<item>
<key>
<string>
type
</string>
</key>
<value>
<string>
string
</string>
</value>
</item>
</dictionary>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
module_list
</string>
</value>
</item>
<item>
<key>
<string>
type
</string>
</key>
<value>
<string>
lines
</string>
</value>
</item>
</dictionary>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
incremental_check
</string>
</value>
</item>
<item>
<key>
<string>
type
</string>
</key>
<value>
<string>
int
</string>
</value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key>
<string>
active_sense_method_id
</string>
</key>
<value>
<string>
Alarm_activateCheckAndFixUnmatchingJIOAPIRevisionHash
</string>
</value>
</item>
<item>
<key>
<string>
automatic_solve
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
catalog_query_string
</string>
</key>
<value>
<string>
validation_state:!=deleted
</string>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
configuration_form_id
</string>
</key>
<value>
<string>
Alarm_viewConsistencyCheckConfiguration
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
jio_api_revision_check_consistency
</string>
</value>
</item>
<item>
<key>
<string>
incremental_check
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
module_list
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_day_frequency
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
periodicity_hour
</string>
</key>
<value>
<tuple>
<int>
0
</int>
</tuple>
</value>
</item>
<item>
<key>
<string>
periodicity_hour_frequency
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
periodicity_minute
</string>
</key>
<value>
<tuple>
<int>
0
</int>
</tuple>
</value>
</item>
<item>
<key>
<string>
periodicity_minute_frequency
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
periodicity_month
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_month_day
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_start_date
</string>
</key>
<value>
<object>
<klass>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1230768000.0
</float>
<string>
GMT
</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
periodicity_week
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_week_day
</string>
</key>
<value>
<tuple>
<string>
Sunday
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
periodicity_week_frequency
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Alarm
</string>
</value>
</item>
<item>
<key>
<string>
report_method_id
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
solve_method_id
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
jIO API Revision Consistency Check
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_api_style/SkinTemplateItem/portal_skins/erp5_api_jio_sql_revision/Alarm_activateCheckAndFixUnmatchingJIOAPIRevisionHash.py
0 → 100644
View file @
8546f2f4
if
not
context
.
Base_zCheckjIOAPIRevisionTableExists
():
context
.
Base_zCreatejIOAPIRevisionTable
()
kw
=
{}
if
context
.
getProperty
(
'incremental_check'
):
last_active_process
=
context
.
getLastActiveProcess
(
include_active
=
True
)
if
last_active_process
is
not
None
:
kw
[
'indexation_timestamp'
]
=
{
'query'
:
last_active_process
.
getStartDate
(),
'range'
:
'>='
}
active_process
=
context
.
newActiveProcess
().
getRelativeUrl
()
query_string
=
context
.
getProperty
(
'catalog_query_string'
,
''
)
# the query sould be something like "validation_state:!=deleted validation_state:!=draft portal_type:Organisation" etc
portal
=
context
.
getPortalObject
()
if
query_string
is
not
None
:
kw
.
update
(
SearchableText
=
query_string
)
parent_uid
=
[
portal
.
restrictedTraverse
(
module
).
getUid
()
for
module
in
context
.
getProperty
(
'module_list'
)
or
[]]
if
parent_uid
:
kw
.
update
(
parent_uid
=
parent_uid
)
portal
.
portal_catalog
.
searchAndActivate
(
method_id
=
'markUnmatchingJIOAPIrevisionHash'
,
activate_kw
=
{
'tag'
:
tag
,
'priority'
:
8
},
**
kw
)
context
.
activate
(
after_tag
=
tag
).
getId
()
bt5/erp5_api_style/SkinTemplateItem/portal_skins/erp5_api_jio_sql_revision/Alarm_activateCheckAndFixUnmatchingJIOAPIRevisionHash.xml
0 → 100644
View file @
8546f2f4
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit=False, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Alarm_activateCheckAndFixUnmatchingJIOAPIRevisionHash
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_api_style/bt/template_path_list
View file @
8546f2f4
portal_alarms/jio_api_revision_check_consistency
portal_alarms/update_jio_api_revision_template
portal_callables/Base_asJSONTextFromJSON
web_page_module/api-style_alldocs-response-schema.json
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment