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
Xiaowu Zhang
slapos.core
Commits
46bd20bd
Commit
46bd20bd
authored
Jul 30, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SlapTool: Migrate to portal components and remote the product
parent
7ed3309d
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
120 additions
and
152 deletions
+120
-152
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
...l_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
+1
-1
master/bt5/slapos_slap_tool/ToolComponentTemplateItem/portal_components/tool.erp5.SlapTool.py
...onentTemplateItem/portal_components/tool.erp5.SlapTool.py
+12
-12
master/bt5/slapos_slap_tool/ToolComponentTemplateItem/portal_components/tool.erp5.SlapTool.xml
...nentTemplateItem/portal_components/tool.erp5.SlapTool.xml
+106
-0
master/bt5/slapos_slap_tool/bt/template_tool_component_id_list
...r/bt5/slapos_slap_tool/bt/template_tool_component_id_list
+1
-0
master/product/Vifib/Document/__init__.py
master/product/Vifib/Document/__init__.py
+0
-0
master/product/Vifib/Permissions.py
master/product/Vifib/Permissions.py
+0
-29
master/product/Vifib/Tool/__init__.py
master/product/Vifib/Tool/__init__.py
+0
-29
master/product/Vifib/VERSION.txt
master/product/Vifib/VERSION.txt
+0
-1
master/product/Vifib/__init__.py
master/product/Vifib/__init__.py
+0
-48
master/product/Vifib/tests/__init__.py
master/product/Vifib/tests/__init__.py
+0
-32
master/product/Vifib/tool.png
master/product/Vifib/tool.png
+0
-0
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
View file @
46bd20bd
...
@@ -2134,7 +2134,7 @@ class TestSecurePaymentTool(TestSlapOSGroupRoleSecurityMixin):
...
@@ -2134,7 +2134,7 @@ class TestSecurePaymentTool(TestSlapOSGroupRoleSecurityMixin):
self
.
assertPermissionsOfRole
(
tool
,
'Owner'
,
[])
self
.
assertPermissionsOfRole
(
tool
,
'Owner'
,
[])
self
.
assertPermissionsOfRole
(
tool
,
'Reviewer'
,
[])
self
.
assertPermissionsOfRole
(
tool
,
'Reviewer'
,
[])
self
.
assertAcquiredPermissions
(
tool
,
[
'Add ERP5 SQL Methods'
,
'Add Vifib Tools'
])
self
.
assertAcquiredPermissions
(
tool
,
[
'Add ERP5 SQL Methods'
])
class
TestBusinessProcessModule
(
TestSlapOSGroupRoleSecurityMixin
):
class
TestBusinessProcessModule
(
TestSlapOSGroupRoleSecurityMixin
):
def
test
(
self
):
def
test
(
self
):
...
...
master/
product/Vifib/Tool/
SlapTool.py
→
master/
bt5/slapos_slap_tool/ToolComponentTemplateItem/portal_components/tool.erp5.
SlapTool.py
View file @
46bd20bd
...
@@ -127,7 +127,7 @@ def _assertACI(document):
...
@@ -127,7 +127,7 @@ def _assertACI(document):
raise
Unauthorized
(
'User %r has no access to %r'
%
(
sm
.
getUser
(),
document
))
raise
Unauthorized
(
'User %r has no access to %r'
%
(
sm
.
getUser
(),
document
))
_MARKER
=
[]
_MARKER
=
object
()
class
SlapTool
(
BaseTool
):
class
SlapTool
(
BaseTool
):
"""SlapTool"""
"""SlapTool"""
...
@@ -252,7 +252,7 @@ class SlapTool(BaseTool):
...
@@ -252,7 +252,7 @@ class SlapTool(BaseTool):
entry
=
cache_plugin
.
get
(
key
,
DEFAULT_CACHE_SCOPE
)
entry
=
cache_plugin
.
get
(
key
,
DEFAULT_CACHE_SCOPE
)
except
KeyError
:
except
KeyError
:
entry
=
None
entry
=
None
if
entry
is
not
None
and
type
(
entry
.
getValue
())
==
type
({}
):
if
entry
is
not
None
and
isinstance
(
entry
.
getValue
(),
dict
):
result
=
entry
.
getValue
()[
'data'
]
result
=
entry
.
getValue
()[
'data'
]
self
.
_activateFillComputerInformationCache
(
computer_id
,
user
)
self
.
_activateFillComputerInformationCache
(
computer_id
,
user
)
return
result
return
result
...
@@ -898,7 +898,7 @@ class SlapTool(BaseTool):
...
@@ -898,7 +898,7 @@ class SlapTool(BaseTool):
try
:
try
:
document
=
etree
.
parse
(
string_to_validate
)
document
=
etree
.
parse
(
string_to_validate
)
except
(
etree
.
XMLSyntaxError
,
etree
.
DocumentInvalid
)
as
e
:
except
(
etree
.
XMLSyntaxError
,
etree
.
DocumentInvalid
)
as
e
:
# pylint: disable=catching-non-exception
LOG
(
'SlapTool::_validateXML'
,
INFO
,
LOG
(
'SlapTool::_validateXML'
,
INFO
,
'Failed to parse this XML reports : %s
\
n
%s'
%
\
'Failed to parse this XML reports : %s
\
n
%s'
%
\
(
to_be_validated
,
e
))
(
to_be_validated
,
e
))
...
@@ -913,8 +913,8 @@ class SlapTool(BaseTool):
...
@@ -913,8 +913,8 @@ class SlapTool(BaseTool):
result_dict
=
{}
result_dict
=
{}
try
:
try
:
result_dict
=
xml2dict
(
xml
)
result_dict
=
xml2dict
(
xml
)
except
(
etree
.
XMLSchemaError
,
etree
.
XMLSchemaParseError
,
except
(
etree
.
XMLSchemaError
,
etree
.
XMLSchemaParseError
,
# pylint: disable=catching-non-exception
etree
.
XMLSchemaValidateError
,
etree
.
XMLSyntaxError
):
etree
.
XMLSchemaValidateError
,
etree
.
XMLSyntaxError
):
# pylint: disable=catching-non-exception
LOG
(
'SlapTool'
,
INFO
,
'Issue during parsing xml:'
,
error
=
True
)
LOG
(
'SlapTool'
,
INFO
,
'Issue during parsing xml:'
,
error
=
True
)
return
result_dict
return
result_dict
...
@@ -1084,7 +1084,7 @@ class SlapTool(BaseTool):
...
@@ -1084,7 +1084,7 @@ class SlapTool(BaseTool):
timestamp
=
str
(
int
(
software_instance
.
getModificationDate
()))
timestamp
=
str
(
int
(
software_instance
.
getModificationDate
()))
key
=
"%s_bangstamp"
%
software_instance
.
getReference
()
key
=
"%s_bangstamp"
%
software_instance
.
getReference
()
transition
=
self
.
getPortalObject
().
portal_workflow
.
getInfoFor
(
self
.
getPortalObject
().
portal_workflow
.
getInfoFor
(
software_instance
,
'action'
,
wf_id
=
'instance_slap_interface_workflow'
)
software_instance
,
'action'
,
wf_id
=
'instance_slap_interface_workflow'
)
if
(
self
.
_getLastData
(
key
)
!=
timestamp
):
if
(
self
.
_getLastData
(
key
)
!=
timestamp
):
...
@@ -1303,12 +1303,12 @@ class SlapTool(BaseTool):
...
@@ -1303,12 +1303,12 @@ class SlapTool(BaseTool):
)
)
last_data
=
self
.
_getLastData
(
key
)
last_data
=
self
.
_getLastData
(
key
)
requested_software_instance
=
None
requested_software_instance
=
None
if
last_data
is
not
None
and
type
(
last_data
)
==
type
({}
):
if
last_data
is
not
None
and
isinstance
(
last_data
,
dict
):
requested_software_instance
=
portal
.
restrictedTraverse
(
requested_software_instance
=
portal
.
restrictedTraverse
(
last_data
.
get
(
'request_instance'
),
None
)
last_data
.
get
(
'request_instance'
),
None
)
if
last_data
is
None
or
type
(
last_data
)
!=
type
(
value
)
or
\
if
last_data
is
None
or
not
isinstance
(
last_data
,
type
(
value
)
)
or
\
last_data
.
get
(
'hash'
)
!=
value
[
'hash'
]
or
\
last_data
.
get
(
'hash'
)
!=
value
[
'hash'
]
or
\
requested_software_instance
is
None
:
requested_software_instance
is
None
:
software_instance_document
.
requestInstance
(
**
kw
)
software_instance_document
.
requestInstance
(
**
kw
)
requested_software_instance
=
self
.
REQUEST
.
get
(
'request_instance'
)
requested_software_instance
=
self
.
REQUEST
.
get
(
'request_instance'
)
if
requested_software_instance
is
not
None
:
if
requested_software_instance
is
not
None
:
...
@@ -1330,10 +1330,10 @@ class SlapTool(BaseTool):
...
@@ -1330,10 +1330,10 @@ class SlapTool(BaseTool):
hash
=
str
(
kw
)
hash
=
str
(
kw
)
)
)
last_data
=
self
.
_getLastData
(
key
)
last_data
=
self
.
_getLastData
(
key
)
if
last_data
is
not
None
and
type
(
last_data
)
==
type
({}
):
if
last_data
is
not
None
and
isinstance
(
last_data
,
dict
):
requested_software_instance
=
portal
.
restrictedTraverse
(
requested_software_instance
=
portal
.
restrictedTraverse
(
last_data
.
get
(
'request_instance'
),
None
)
last_data
.
get
(
'request_instance'
),
None
)
if
last_data
is
None
or
type
(
last_data
)
!=
type
(
value
)
or
\
if
last_data
is
None
or
not
isinstance
(
last_data
,
type
(
value
)
)
or
\
last_data
.
get
(
'hash'
)
!=
value
[
'hash'
]
or
\
last_data
.
get
(
'hash'
)
!=
value
[
'hash'
]
or
\
requested_software_instance
is
None
:
requested_software_instance
is
None
:
person
.
requestSoftwareInstance
(
**
kw
)
person
.
requestSoftwareInstance
(
**
kw
)
...
@@ -1634,4 +1634,4 @@ class SlapTool(BaseTool):
...
@@ -1634,4 +1634,4 @@ class SlapTool(BaseTool):
self
.
_logAccess
(
user
,
software_installation_reference
,
self
.
_logAccess
(
user
,
software_installation_reference
,
'#error while installing %s'
%
url
)
'#error while installing %s'
%
url
)
InitializeClass
(
SlapTool
)
InitializeClass
(
SlapTool
)
\ No newline at end of file
master/bt5/slapos_slap_tool/ToolComponentTemplateItem/portal_components/tool.erp5.SlapTool.xml
0 → 100644
View file @
46bd20bd
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Tool Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
SlapTool
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
tool.erp5.SlapTool
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Tool Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_slap_tool/bt/template_tool_component_id_list
0 → 100644
View file @
46bd20bd
tool.erp5.SlapTool
\ No newline at end of file
master/product/Vifib/Document/__init__.py
deleted
100644 → 0
View file @
7ed3309d
master/product/Vifib/Permissions.py
deleted
100644 → 0
View file @
7ed3309d
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Łukasz Nowak <luke@nexedi.com>
# Romain Courteaud <romain@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
master/product/Vifib/Tool/__init__.py
deleted
100644 → 0
View file @
7ed3309d
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Łukasz Nowak <luke@nexedi.com>
# Romain Courteaud <romain@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
master/product/Vifib/VERSION.txt
deleted
100644 → 0
View file @
7ed3309d
Vifib 0.5
master/product/Vifib/__init__.py
deleted
100644 → 0
View file @
7ed3309d
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Łukasz Nowak <luke@nexedi.com>
# Romain Courteaud <romain@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
Products.ERP5Type.Utils
import
initializeProduct
,
updateGlobals
import
sys
import
Permissions
this_module
=
sys
.
modules
[
__name__
]
document_classes
=
updateGlobals
(
this_module
,
globals
(),
permissions_module
=
Permissions
)
object_classes
=
()
content_classes
=
()
content_constructors
=
()
from
Tool
import
SlapTool
portal_tools
=
(
SlapTool
.
SlapTool
,
)
def
initialize
(
context
):
import
Document
initializeProduct
(
context
,
this_module
,
globals
(),
document_module
=
Document
,
document_classes
=
document_classes
,
object_classes
=
object_classes
,
portal_tools
=
portal_tools
,
content_constructors
=
content_constructors
,
content_classes
=
content_classes
)
master/product/Vifib/tests/__init__.py
deleted
100644 → 0
View file @
7ed3309d
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Łukasz Nowak <luke@nexedi.com>
# Romain Courteaud <romain@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
"""
\
Unit test package for Vifib
"""
master/product/Vifib/tool.png
deleted
100644 → 0
View file @
7ed3309d
287 Bytes
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