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
Paul Graydon
slapos.core
Commits
f904129e
Commit
f904129e
authored
Jan 07, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SlapTool: Store since when the logged information is there.
parent
390480e4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
112 additions
and
21 deletions
+112
-21
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapTool.py
...ateItem/portal_components/test.erp5.testSlapOSSlapTool.py
+76
-1
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapTool.xml
...teItem/portal_components/test.erp5.testSlapOSSlapTool.xml
+17
-16
master/product/Vifib/Tool/SlapTool.py
master/product/Vifib/Tool/SlapTool.py
+19
-4
No files found.
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapTool.py
View file @
f904129e
...
...
@@ -13,7 +13,6 @@ import xml.dom.ext.reader.Sax
import
xml.dom.ext
import
StringIO
import
difflib
import
transaction
from
OFS.Traversable
import
NotFound
class
Simulator
:
...
...
@@ -451,6 +450,7 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
def
test_not_accessed_getComputerStatus
(
self
):
self
.
login
(
self
.
computer_user_id
)
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
response
=
self
.
portal_slap
.
getComputerStatus
(
self
.
computer_id
)
self
.
assertEqual
(
200
,
response
.
status
)
self
.
assertEqual
(
'public, max-age=60, stale-if-error=604800'
,
...
...
@@ -474,6 +474,8 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#error no data found for %(computer_id)s</string>
<string>user</string>
...
...
@@ -482,6 +484,7 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
computer_id
=
self
.
computer_id
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
...
...
@@ -492,6 +495,7 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
self
.
portal_slap
.
getFullComputerInformation
(
self
.
computer_id
)
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
response
=
self
.
portal_slap
.
getComputerStatus
(
self
.
computer_id
)
self
.
assertEqual
(
200
,
response
.
status
)
self
.
assertEqual
(
'public, max-age=60, stale-if-error=604800'
,
...
...
@@ -516,6 +520,8 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#access %(computer_id)s</string>
<string>user</string>
...
...
@@ -524,6 +530,7 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
computer_id
=
self
.
computer_id
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
...
...
@@ -549,6 +556,7 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
error_log
)
self
.
assertEqual
(
'None'
,
response
)
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
response
=
self
.
portal_slap
.
getComputerStatus
(
self
.
computer_id
)
# check returned XML
xml_fp
=
StringIO
.
StringIO
()
...
...
@@ -563,6 +571,8 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#error bang</string>
<string>user</string>
...
...
@@ -571,6 +581,7 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
computer_id
=
self
.
computer_id
,
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
...
...
@@ -618,6 +629,7 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
self
.
computer_bang_simulator
=
tempfile
.
mkstemp
()[
1
]
self
.
login
(
self
.
computer_user_id
)
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
software_installation
=
self
.
start_requested_software_installation
url_string
=
software_installation
.
getUrlString
()
response
=
self
.
portal_slap
.
getSoftwareInstallationStatus
(
url_string
,
...
...
@@ -644,6 +656,8 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#error no data found for %(reference)s</string>
<string>user</string>
...
...
@@ -652,6 +666,7 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
reference
=
software_installation
.
getReference
()
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
...
...
@@ -691,6 +706,7 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
url_string
,
self
.
computer_id
)
self
.
assertEqual
(
'None'
,
response
)
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
response
=
self
.
portal_slap
.
getSoftwareInstallationStatus
(
url_string
,
self
.
computer_id
)
# check returned XML
...
...
@@ -706,6 +722,8 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#access software release %(url_string)s available</string>
<string>user</string>
...
...
@@ -714,6 +732,7 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
url_string
=
url_string
,
computer_id
=
self
.
computer_id
,
)
...
...
@@ -730,6 +749,7 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
url_string
,
self
.
computer_id
)
self
.
assertEqual
(
'None'
,
response
)
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
response
=
self
.
portal_slap
.
getSoftwareInstallationStatus
(
url_string
,
self
.
computer_id
)
# check returned XML
...
...
@@ -745,6 +765,8 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#building software release %(url_string)s</string>
<string>user</string>
...
...
@@ -753,6 +775,7 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
url_string
=
url_string
,
computer_id
=
self
.
computer_id
,
)
...
...
@@ -769,6 +792,7 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
url_string
,
self
.
computer_id
,
'error log'
)
self
.
assertEqual
(
'None'
,
response
)
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
response
=
self
.
portal_slap
.
getSoftwareInstallationStatus
(
url_string
,
self
.
computer_id
)
# check returned XML
...
...
@@ -784,6 +808,8 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#error while installing %(url_string)s</string>
<string>user</string>
...
...
@@ -792,6 +818,7 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
url_string
=
url_string
,
computer_id
=
self
.
computer_id
,
)
...
...
@@ -1091,6 +1118,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
partition_id
=
self
.
start_requested_software_instance
.
getAggregateValue
(
portal_type
=
'Computer Partition'
).
getReference
()
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
self
.
login
(
self
.
start_requested_software_instance
.
getUserId
())
response
=
self
.
portal_slap
.
getComputerPartitionStatus
(
self
.
computer_id
,
partition_id
)
...
...
@@ -1115,6 +1143,8 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#error no data found for %(instance_guid)s</string>
<string>user</string>
...
...
@@ -1123,6 +1153,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
instance_guid
=
self
.
start_requested_software_instance
.
getReference
(),
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
...
...
@@ -1133,6 +1164,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
partition_id
=
self
.
start_requested_software_instance
.
getAggregateValue
(
portal_type
=
'Computer Partition'
).
getReference
()
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
self
.
login
(
self
.
start_requested_software_instance
.
getUserId
())
self
.
portal_slap
.
registerComputerPartition
(
self
.
computer_id
,
partition_id
)
response
=
self
.
portal_slap
.
getComputerPartitionStatus
(
self
.
computer_id
,
...
...
@@ -1158,6 +1190,8 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#error no data found for %(instance_guid)s</string>
<string>user</string>
...
...
@@ -1166,6 +1200,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
instance_guid
=
self
.
start_requested_software_instance
.
getReference
(),
computer_id
=
self
.
computer_id
,
partition_id
=
partition_id
...
...
@@ -1507,6 +1542,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
partition_id
,
error_log
)
self
.
assertEqual
(
'None'
,
response
)
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
response
=
self
.
portal_slap
.
getComputerPartitionStatus
(
self
.
computer_id
,
partition_id
)
# check returned XML
...
...
@@ -1522,6 +1558,8 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#error while instanciating: The error</string>
<string>user</string>
...
...
@@ -1530,6 +1568,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
instance_guid
=
self
.
start_requested_software_instance
.
getReference
(),
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
...
...
@@ -1557,6 +1596,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
partition_id
,
error_log
)
self
.
assertEqual
(
'OK'
,
response
)
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
response
=
self
.
portal_slap
.
getComputerPartitionStatus
(
self
.
computer_id
,
partition_id
)
# check returned XML
...
...
@@ -1572,6 +1612,8 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#error bang called</string>
<string>user</string>
...
...
@@ -1580,6 +1622,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
instance_guid
=
self
.
start_requested_software_instance
.
getReference
(),
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
...
...
@@ -1832,6 +1875,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
partition_id
)
self
.
assertEqual
(
'None'
,
response
)
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
response
=
self
.
portal_slap
.
getComputerPartitionStatus
(
self
.
computer_id
,
partition_id
)
# check returned XML
...
...
@@ -1847,6 +1891,8 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#access Instance correctly stopped</string>
<string>user</string>
...
...
@@ -1855,6 +1901,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
instance_guid
=
self
.
start_requested_software_instance
.
getReference
(),
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
...
...
@@ -1869,6 +1916,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
partition_id
)
self
.
assertEqual
(
'None'
,
response
)
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
response
=
self
.
portal_slap
.
getComputerPartitionStatus
(
self
.
computer_id
,
partition_id
)
# check returned XML
...
...
@@ -1884,6 +1932,8 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#access Instance correctly started</string>
<string>user</string>
...
...
@@ -1892,6 +1942,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
instance_guid
=
self
.
start_requested_software_instance
.
getReference
(),
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
...
...
@@ -2098,6 +2149,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def
test_not_accessed_getComputerStatus
(
self
):
self
.
login
(
self
.
person_user_id
)
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
response
=
self
.
portal_slap
.
getComputerStatus
(
self
.
computer_id
)
self
.
assertEqual
(
200
,
response
.
status
)
self
.
assertEqual
(
'public, max-age=60, stale-if-error=604800'
,
...
...
@@ -2121,6 +2173,8 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#error no data found for %(computer_id)s</string>
<string>user</string>
...
...
@@ -2129,6 +2183,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
computer_id
=
self
.
computer_id
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
...
...
@@ -2139,6 +2194,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
self
.
portal_slap
.
getFullComputerInformation
(
self
.
computer_id
)
self
.
login
(
self
.
person_user_id
)
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
response
=
self
.
portal_slap
.
getComputerStatus
(
self
.
computer_id
)
self
.
assertEqual
(
200
,
response
.
status
)
self
.
assertEqual
(
'public, max-age=60, stale-if-error=604800'
,
...
...
@@ -2163,6 +2219,8 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#access %(computer_id)s</string>
<string>user</string>
...
...
@@ -2171,6 +2229,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
computer_id
=
self
.
computer_id
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
...
...
@@ -2195,6 +2254,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
error_log
)
self
.
assertEqual
(
'None'
,
response
)
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
response
=
self
.
portal_slap
.
getComputerStatus
(
self
.
computer_id
)
# check returned XML
xml_fp
=
StringIO
.
StringIO
()
...
...
@@ -2209,6 +2269,8 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#error bang</string>
<string>user</string>
...
...
@@ -2217,6 +2279,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
person_reference
=
self
.
person_reference
,
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
...
...
@@ -2232,6 +2295,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
partition_id
=
self
.
start_requested_software_instance
.
getAggregateValue
(
portal_type
=
'Computer Partition'
).
getReference
()
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
self
.
login
(
self
.
start_requested_software_instance
.
getUserId
())
response
=
self
.
portal_slap
.
getComputerPartitionStatus
(
self
.
computer_id
,
partition_id
)
...
...
@@ -2256,6 +2320,8 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#error no data found for %(instance_guid)s</string>
<string>user</string>
...
...
@@ -2264,6 +2330,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
instance_guid
=
self
.
start_requested_software_instance
.
getReference
(),
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
...
...
@@ -2275,6 +2342,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
partition_id
=
self
.
start_requested_software_instance
.
getAggregateValue
(
portal_type
=
'Computer Partition'
).
getReference
()
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
self
.
login
(
self
.
start_requested_software_instance
.
getUserId
())
self
.
portal_slap
.
registerComputerPartition
(
self
.
computer_id
,
partition_id
)
self
.
login
(
self
.
person_user_id
)
...
...
@@ -2301,6 +2369,8 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#error no data found for %(instance_guid)s</string>
<string>user</string>
...
...
@@ -2309,6 +2379,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
instance_guid
=
self
.
start_requested_software_instance
.
getReference
(),
computer_id
=
self
.
computer_id
,
partition_id
=
partition_id
...
...
@@ -2587,6 +2658,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
partition_id
,
error_log
)
self
.
assertEqual
(
'OK'
,
response
)
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
response
=
self
.
portal_slap
.
getComputerPartitionStatus
(
self
.
computer_id
,
partition_id
)
# check returned XML
...
...
@@ -2602,6 +2674,8 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
<dictionary id='i2'>
<string>created_at</string>
<string>%(created_at)s</string>
<string>since</string>
<string>%(since)s</string>
<string>text</string>
<string>#error bang called</string>
<string>user</string>
...
...
@@ -2610,6 +2684,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
</marshal>
"""
%
dict
(
created_at
=
created_at
,
since
=
since
,
person_reference
=
self
.
person_reference
,
)
self
.
assertEqual
(
expected_xml
,
got_xml
,
...
...
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapTool.xml
View file @
f904129e
...
...
@@ -46,22 +46,22 @@
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 2
8
, 10: Use of eval (eval-used)
</string>
<string>
W:5
29
, 13: Use of eval (eval-used)
</string>
<string>
W:5
80
, 13: Use of eval (eval-used)
</string>
<string>
W:8
05
, 13: Use of eval (eval-used)
</string>
<string>
W:14
22
, 13: Use of eval (eval-used)
</string>
<string>
W:15
35
, 13: Use of eval (eval-used)
</string>
<string>
W:1
589
, 13: Use of eval (eval-used)
</string>
<string>
W:16
29
, 13: Use of eval (eval-used)
</string>
<string>
W:2
177
, 13: Use of eval (eval-used)
</string>
<string>
W:2
566
, 13: Use of eval (eval-used)
</string>
<string>
W:26
20
, 13: Use of eval (eval-used)
</string>
<string>
W:2
647
, 13: Use of eval (eval-used)
</string>
<string>
W:28
04
, 13: Use of eval (eval-used)
</string>
<string>
W:2
832
, 13: Use of eval (eval-used)
</string>
<string>
W:2
881
, 13: Use of eval (eval-used)
</string>
<string>
W:
2928
, 13: Use of eval (eval-used)
</string>
<string>
W: 2
7
, 10: Use of eval (eval-used)
</string>
<string>
W:5
40
, 13: Use of eval (eval-used)
</string>
<string>
W:5
95
, 13: Use of eval (eval-used)
</string>
<string>
W:8
36
, 13: Use of eval (eval-used)
</string>
<string>
W:14
61
, 13: Use of eval (eval-used)
</string>
<string>
W:15
78
, 13: Use of eval (eval-used)
</string>
<string>
W:1
636
, 13: Use of eval (eval-used)
</string>
<string>
W:16
76
, 13: Use of eval (eval-used)
</string>
<string>
W:2
239
, 13: Use of eval (eval-used)
</string>
<string>
W:2
640
, 13: Use of eval (eval-used)
</string>
<string>
W:26
98
, 13: Use of eval (eval-used)
</string>
<string>
W:2
725
, 13: Use of eval (eval-used)
</string>
<string>
W:28
82
, 13: Use of eval (eval-used)
</string>
<string>
W:2
910
, 13: Use of eval (eval-used)
</string>
<string>
W:2
959
, 13: Use of eval (eval-used)
</string>
<string>
W:
3006
, 13: Use of eval (eval-used)
</string>
</tuple>
</value>
</item>
...
...
@@ -134,6 +134,7 @@
</item>
</dictionary>
</list>
<none/>
</tuple>
</pickle>
</record>
...
...
master/product/Vifib/Tool/SlapTool.py
View file @
f904129e
...
...
@@ -863,10 +863,22 @@ class SlapTool(BaseTool):
def
_logAccess
(
self
,
user_reference
,
context_reference
,
text
):
memcached_dict
=
self
.
Base_getSlapToolMemcachedDict
()
previous
=
self
.
_getCachedAccessInfo
(
context_reference
)
created_at
=
rfc1123_date
(
DateTime
())
since
=
created_at
if
previous
is
not
None
:
previous_json
=
json
.
loads
(
previous
)
if
text
.
split
(
" "
)[
0
]
==
previous_json
.
get
(
"text"
,
""
).
split
(
" "
)[
0
]:
since
=
previous_json
.
get
(
"since"
,
previous_json
.
get
(
"created_at"
,
rfc1123_date
(
DateTime
())))
value
=
json
.
dumps
({
'user'
:
'%s'
%
user_reference
,
'created_at'
:
'%s'
%
rfc1123_date
(
DateTime
())
,
'created_at'
:
'%s'
%
created_at
,
'text'
:
'%s'
%
text
,
'since'
:
'%s'
%
since
})
memcached_dict
[
context_reference
]
=
value
...
...
@@ -1098,17 +1110,20 @@ class SlapTool(BaseTool):
def
_getAccessStatus
(
self
,
context_reference
):
d
=
self
.
_getCachedAccessInfo
(
context_reference
)
last_modified
=
rfc1123_date
(
DateTime
())
if
d
is
None
:
if
context_reference
is
None
:
d
=
{
"user"
:
"SlapOS Master"
,
'created_at'
:
'%s'
%
rfc1123_date
(
DateTime
()),
'created_at'
:
'%s'
%
last_modified
,
'since'
:
'%s'
%
last_modified
,
"text"
:
"#error no data found"
}
else
:
d
=
{
"user"
:
"SlapOS Master"
,
'created_at'
:
'%s'
%
rfc1123_date
(
DateTime
()),
'created_at'
:
'%s'
%
last_modified
,
'since'
:
'%s'
%
last_modified
,
"text"
:
"#error no data found for %s"
%
context_reference
}
# Prepare for xml marshalling
...
...
@@ -1123,7 +1138,7 @@ class SlapTool(BaseTool):
'public, max-age=60, stale-if-error=604800'
)
self
.
REQUEST
.
response
.
setHeader
(
'Vary'
,
'REMOTE_USER'
)
self
.
REQUEST
.
response
.
setHeader
(
'Last-Modified'
,
rfc1123_date
(
DateTime
())
)
self
.
REQUEST
.
response
.
setHeader
(
'Last-Modified'
,
last_modified
)
self
.
REQUEST
.
response
.
setHeader
(
'Content-Type'
,
'text/xml; charset=utf-8'
)
self
.
REQUEST
.
response
.
setBody
(
xml_marshaller
.
xml_marshaller
.
dumps
(
d
))
return
self
.
REQUEST
.
response
...
...
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