Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
slapos.core
Commits
a41e32d8
Commit
a41e32d8
authored
Sep 29, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_rss_style: Clean up and drop duplication
... Unify scripts into Base_getEventList
parent
86a5c7c1
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
25 additions
and
213 deletions
+25
-213
master/bt5/slapos_rss_style/SkinTemplateItem/portal_skins/slapos_rss_style/Base_getEventList.py
...teItem/portal_skins/slapos_rss_style/Base_getEventList.py
+13
-3
master/bt5/slapos_rss_style/SkinTemplateItem/portal_skins/slapos_rss_style/Base_getEventList.xml
...eItem/portal_skins/slapos_rss_style/Base_getEventList.xml
+2
-2
master/bt5/slapos_rss_style/SkinTemplateItem/portal_skins/slapos_rss_style/Base_getTicketRelatedEventList.py
..._skins/slapos_rss_style/Base_getTicketRelatedEventList.py
+4
-65
master/bt5/slapos_rss_style/SkinTemplateItem/portal_skins/slapos_rss_style/Event_getRSSTextContent.py
.../portal_skins/slapos_rss_style/Event_getRSSTextContent.py
+0
-16
master/bt5/slapos_rss_style/SkinTemplateItem/portal_skins/slapos_rss_style/Folder_getOpenTicketList.py
...portal_skins/slapos_rss_style/Folder_getOpenTicketList.py
+4
-63
master/bt5/slapos_rss_style/SkinTemplateItem/portal_skins/slapos_rss_style/WebSection_getUserTicketList.xml
...l_skins/slapos_rss_style/WebSection_getUserTicketList.xml
+0
-62
master/bt5/slapos_rss_style/SkinTemplateItem/portal_skins/slapos_rss_style/WebSection_viewCriticalTicketListAsRSS/listbox.xml
..._style/WebSection_viewCriticalTicketListAsRSS/listbox.xml
+1
-1
master/bt5/slapos_rss_style/SkinTemplateItem/portal_skins/slapos_rss_style/WebSection_viewTicketListAsRSS/listbox.xml
...apos_rss_style/WebSection_viewTicketListAsRSS/listbox.xml
+1
-1
No files found.
master/bt5/slapos_rss_style/SkinTemplateItem/portal_skins/slapos_rss_style/
WebSection_getUserTicke
tList.py
→
master/bt5/slapos_rss_style/SkinTemplateItem/portal_skins/slapos_rss_style/
Base_getEven
tList.py
View file @
a41e32d8
...
...
@@ -24,19 +24,29 @@ def getTicketInfo(event):
)
return
getTicket_memo
[
follow_up
]
if
follow_up_portal_type
is
None
:
follow_up_portal_type
=
[
'Support Request'
,
'Regularisation Request'
,
'Upgrade Decision'
]
context_kw
=
{}
if
context_related
:
context_kw
[
'follow_up_default_or_child_aggregate_uid'
]
=
context
.
getUid
()
data_list
=
[]
for
brain
in
portal
.
portal_simulation
.
getMovementHistoryList
(
security_query
=
portal
.
portal_catalog
.
getSecurityQuery
(),
# Limit only to listable portal types
portal_type
=
[
'Web Message'
,
'Mail Nessage'
],
follow_up_simulation_state
=
"NOT cancelled"
,
follow_up_simulation_state
=
[
'validated'
,
'submitted'
,
'suspended'
,
'invalidated'
,
# Unfortunally Upgrade decision uses diferent states.
'confirmed'
,
'started'
,
'stopped'
,
'delivered'
],
only_accountable
=
False
,
follow_up_portal_type
=
[
'Support Request'
,
'Regularisation Request'
,
'Upgrade Decision'
]
,
follow_up_portal_type
=
follow_up_portal_type
,
omit_input
=
True
,
simulation_state
=
(
'started'
,
'stopped'
,
'delivered'
),
limit
=
list_lines
,
sort_on
=
((
'stock.date'
,
'desc'
),
(
'uid'
,
'desc'
)),):
(
'uid'
,
'desc'
)),
**
context_kw
):
event
=
brain
.
getObject
()
(
ticket_title
,
ticket_category
,
...
...
master/bt5/slapos_rss_style/SkinTemplateItem/portal_skins/slapos_rss_style/
Event_getRSSTextConten
t.xml
→
master/bt5/slapos_rss_style/SkinTemplateItem/portal_skins/slapos_rss_style/
Base_getEventLis
t.xml
View file @
a41e32d8
...
...
@@ -50,11 +50,11 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
list_lines=50, follow_up_portal_type=None, context_related=False, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Event_getRSSTextConten
t
</string>
</value>
<value>
<string>
Base_getEventLis
t
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/slapos_rss_style/SkinTemplateItem/portal_skins/slapos_rss_style/Base_getTicketRelatedEventList.py
View file @
a41e32d8
"""Returns all ticket related events for RSS from a given module
"""
from
Products.PythonScripts.standard
import
Object
portal
=
context
.
getPortalObject
()
# for safety, we limit at 100 lines
list_lines
=
min
(
list_lines
,
100
)
getTicket_memo
=
{}
def
getTicketInfo
(
event
):
follow_up
=
event
.
getFollowUp
()
try
:
return
getTicket_memo
[
follow_up
]
except
KeyError
:
ticket
=
portal
.
restrictedTraverse
(
follow_up
,
None
)
if
ticket
is
None
:
# For corner cases where user has an event for which he cannot access the ticket,
# we don't raise error so that others events are visible.
return
event
.
getTitle
(),
''
,
''
getTicket_memo
[
follow_up
]
=
(
ticket
.
getTitle
(),
ticket
.
getResourceTranslatedTitle
()
or
''
,
ticket
.
Base_getTicketUrl
(),
)
return
getTicket_memo
[
follow_up
]
data_list
=
[]
for
brain
in
portal
.
portal_simulation
.
getMovementHistoryList
(
security_query
=
portal
.
portal_catalog
.
getSecurityQuery
(),
# Limit only to listable portal types
portal_type
=
[
'Web Message'
,
'Mail Nessage'
],
follow_up_default_or_child_aggregate_uid
=
context
.
getUid
(),
follow_up_simulation_state
=
[
'validated'
,
'submitted'
,
'suspended'
,
'invalidated'
,
# Unfortunally Upgrade decision uses diferent states.
'confirmed'
,
'started'
,
'stopped'
,
'delivered'
],
only_accountable
=
False
,
# Only query by portal types of the module
follow_up_portal_type
=
[
"Support Request"
,
"Upgrade Decision"
],
omit_input
=
True
,
simulation_state
=
(
'started'
,
'stopped'
,
'delivered'
),
limit
=
list_lines
,
sort_on
=
((
'stock.date'
,
'desc'
),
(
'uid'
,
'desc'
)),):
event
=
brain
.
getObject
()
(
ticket_title
,
ticket_category
,
ticket_link
)
=
getTicketInfo
(
event
)
data_list
.
append
(
Object
(
**
{
'title'
:
ticket_title
,
'category'
:
ticket_category
,
'author'
:
brain
.
node_title
,
'link'
:
ticket_link
,
'description'
:
event
.
Event_getRSSTextContent
(),
'pubDate'
:
brain
.
date
,
'guid'
:
'{}-{}'
.
format
(
event
.
getFollowUp
(),
event
.
getRelativeUrl
()),
'thumbnail'
:
(
None
)
})
)
return
data_list
return
context
.
Base_getEventList
(
list_lines
=
list_lines
,
follow_up_portal_type
=
[
'Support Request'
,
'Upgrade Decision'
],
context_related
=
True
,
**
kw
)
master/bt5/slapos_rss_style/SkinTemplateItem/portal_skins/slapos_rss_style/Event_getRSSTextContent.py
deleted
100644 → 0
View file @
86a5c7c1
"""
Include information of the sender/recipient to clarify.
"""
return
"""
Sender: %s
Recipient: %s
Content:
%s
"""
%
(
context
.
getSourceTitle
(
""
),
","
.
join
(
context
.
getDestinationTitleList
()),
context
.
getTextContent
())
master/bt5/slapos_rss_style/SkinTemplateItem/portal_skins/slapos_rss_style/Folder_getOpenTicketList.py
View file @
a41e32d8
"""Returns all ticket related events for RSS from a given module
"""
from
Products.PythonScripts.standard
import
Object
portal
=
context
.
getPortalObject
()
# for safety, we limit at 100 lines
list_lines
=
min
(
list_lines
,
100
)
getTicket_memo
=
{}
def
getTicketInfo
(
event
):
follow_up
=
event
.
getFollowUp
()
try
:
return
getTicket_memo
[
follow_up
]
except
KeyError
:
ticket
=
portal
.
restrictedTraverse
(
follow_up
,
None
)
if
ticket
is
None
:
# For corner cases where user has an event for which he cannot access the ticket,
# we don't raise error so that others events are visible.
return
event
.
getTitle
(),
''
,
''
getTicket_memo
[
follow_up
]
=
(
ticket
.
getTitle
(),
ticket
.
getResourceTranslatedTitle
()
or
''
,
ticket
.
Base_getTicketUrl
(),
)
return
getTicket_memo
[
follow_up
]
data_list
=
[]
for
brain
in
portal
.
portal_simulation
.
getMovementHistoryList
(
security_query
=
portal
.
portal_catalog
.
getSecurityQuery
(),
# Limit only to listable portal types
portal_type
=
[
'Web Message'
,
'Mail Nessage'
],
follow_up_simulation_state
=
[
'validated'
,
'submitted'
,
'suspended'
,
'invalidated'
,
# Unfortunally Upgrade decision uses diferent states.
'confirmed'
,
'started'
,
'stopped'
,
'delivered'
],
only_accountable
=
False
,
# Only query by portal types of the module
follow_up_portal_type
=
context
.
getVisibleAllowedContentTypeList
(),
omit_input
=
True
,
simulation_state
=
(
'started'
,
'stopped'
,
'delivered'
),
limit
=
list_lines
,
sort_on
=
((
'stock.date'
,
'desc'
),
(
'uid'
,
'desc'
)),):
event
=
brain
.
getObject
()
(
ticket_title
,
ticket_category
,
ticket_link
)
=
getTicketInfo
(
event
)
data_list
.
append
(
Object
(
**
{
'title'
:
ticket_title
,
'category'
:
ticket_category
,
'author'
:
brain
.
node_title
,
'link'
:
ticket_link
,
'description'
:
event
.
Event_getRSSTextContent
(),
'pubDate'
:
brain
.
date
,
'guid'
:
'{}-{}'
.
format
(
event
.
getFollowUp
(),
event
.
getRelativeUrl
()),
'thumbnail'
:
(
None
)
})
)
return
data_list
return
context
.
Base_getEventList
(
list_lines
=
list_lines
,
follow_up_portal_type
=
context
.
getVisibleAllowedContentTypeList
(),
context_related
=
False
,
**
kw
)
master/bt5/slapos_rss_style/SkinTemplateItem/portal_skins/slapos_rss_style/WebSection_getUserTicketList.xml
deleted
100644 → 0
View file @
86a5c7c1
<?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>
list_lines=50, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
WebSection_getUserTicketList
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_rss_style/SkinTemplateItem/portal_skins/slapos_rss_style/WebSection_viewCriticalTicketListAsRSS/listbox.xml
View file @
a41e32d8
...
...
@@ -246,7 +246,7 @@
<dictionary>
<item>
<key>
<string>
method_name
</string>
</key>
<value>
<string>
WebSection_getUserTicke
tList
</string>
</value>
<value>
<string>
Base_getEven
tList
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/slapos_rss_style/SkinTemplateItem/portal_skins/slapos_rss_style/WebSection_viewTicketListAsRSS/listbox.xml
View file @
a41e32d8
...
...
@@ -246,7 +246,7 @@
<dictionary>
<item>
<key>
<string>
method_name
</string>
</key>
<value>
<string>
Base_get
TicketRelated
EventList
</string>
</value>
<value>
<string>
Base_getEventList
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
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