Commit 914d7964 authored by Romain Courteaud's avatar Romain Courteaud

Do use data retrieval to report the status.

parent 7a1ec4c5
...@@ -420,7 +420,8 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin): ...@@ -420,7 +420,8 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
def test_accessed_getComputerStatus(self): def test_accessed_getComputerStatus(self):
self.login(self.computer_id) self.login(self.computer_id)
self.portal_slap.getComputerInformation(self.computer_id) self.portal_slap.softwareReleaseError(
'http://example.org', self.computer_id, 'error log')
created_at = rfc1123_date(DateTime()) created_at = rfc1123_date(DateTime())
response = self.portal_slap.getComputerStatus(self.computer_id) response = self.portal_slap.getComputerStatus(self.computer_id)
self.assertEqual(200, response.status) self.assertEqual(200, response.status)
...@@ -447,7 +448,7 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin): ...@@ -447,7 +448,7 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
<unicode>created_at</unicode> <unicode>created_at</unicode>
<unicode>%(created_at)s</unicode> <unicode>%(created_at)s</unicode>
<unicode>text</unicode> <unicode>text</unicode>
<unicode>#access %(computer_id)s</unicode> <unicode>#error while installing http://example.org</unicode>
<unicode>user</unicode> <unicode>user</unicode>
<unicode>%(computer_id)s</unicode> <unicode>%(computer_id)s</unicode>
</dictionary> </dictionary>
...@@ -1624,7 +1625,8 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -1624,7 +1625,8 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def test_accessed_getComputerStatus(self): def test_accessed_getComputerStatus(self):
self.login(self.computer_id) self.login(self.computer_id)
self.portal_slap.getComputerInformation(self.computer_id) self.portal_slap.softwareReleaseError(
'http://example.org', self.computer_id, 'error log')
self.login(self.person_reference) self.login(self.person_reference)
created_at = rfc1123_date(DateTime()) created_at = rfc1123_date(DateTime())
response = self.portal_slap.getComputerStatus(self.computer_id) response = self.portal_slap.getComputerStatus(self.computer_id)
...@@ -1652,7 +1654,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -1652,7 +1654,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
<unicode>created_at</unicode> <unicode>created_at</unicode>
<unicode>%(created_at)s</unicode> <unicode>%(created_at)s</unicode>
<unicode>text</unicode> <unicode>text</unicode>
<unicode>#access %(computer_id)s</unicode> <unicode>#error while installing http://example.org</unicode>
<unicode>user</unicode> <unicode>user</unicode>
<unicode>%(computer_id)s</unicode> <unicode>%(computer_id)s</unicode>
</dictionary> </dictionary>
......
21 22
\ No newline at end of file \ No newline at end of file
...@@ -282,7 +282,6 @@ class SlapTool(BaseTool): ...@@ -282,7 +282,6 @@ class SlapTool(BaseTool):
Reuses slap library for easy marshalling. Reuses slap library for easy marshalling.
""" """
user = self.getPortalObject().portal_membership.getAuthenticatedMember().getUserName() user = self.getPortalObject().portal_membership.getAuthenticatedMember().getUserName()
self._logAccess(user, user, '#access %s' % computer_id)
result = self._getComputerInformation(computer_id, user) result = self._getComputerInformation(computer_id, user)
if self.REQUEST.response.getStatus() == 200: if self.REQUEST.response.getStatus() == 200:
...@@ -686,11 +685,6 @@ class SlapTool(BaseTool): ...@@ -686,11 +685,6 @@ class SlapTool(BaseTool):
slap_partition._parameter_dict.update(parameter_dict) slap_partition._parameter_dict.update(parameter_dict)
result = xml_marshaller.xml_marshaller.dumps(slap_partition) result = xml_marshaller.xml_marshaller.dumps(slap_partition)
user = self.getPortalObject().portal_membership.\
getAuthenticatedMember().getUserName()
self._logAccess(user, user, '#access %s %s' % (computer_reference,
computer_partition_reference))
# Keep in cache server for 7 days # Keep in cache server for 7 days
self.REQUEST.response.setStatus(200) self.REQUEST.response.setStatus(200)
self.REQUEST.response.setHeader('Cache-Control', self.REQUEST.response.setHeader('Cache-Control',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment