Commit f904129e authored by Rafael Monnerat's avatar Rafael Monnerat

SlapTool: Store since when the logged information is there.

parent 390480e4
......@@ -46,22 +46,22 @@
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 28, 10: Use of eval (eval-used)</string>
<string>W:529, 13: Use of eval (eval-used)</string>
<string>W:580, 13: Use of eval (eval-used)</string>
<string>W:805, 13: Use of eval (eval-used)</string>
<string>W:1422, 13: Use of eval (eval-used)</string>
<string>W:1535, 13: Use of eval (eval-used)</string>
<string>W:1589, 13: Use of eval (eval-used)</string>
<string>W:1629, 13: Use of eval (eval-used)</string>
<string>W:2177, 13: Use of eval (eval-used)</string>
<string>W:2566, 13: Use of eval (eval-used)</string>
<string>W:2620, 13: Use of eval (eval-used)</string>
<string>W:2647, 13: Use of eval (eval-used)</string>
<string>W:2804, 13: Use of eval (eval-used)</string>
<string>W:2832, 13: Use of eval (eval-used)</string>
<string>W:2881, 13: Use of eval (eval-used)</string>
<string>W:2928, 13: Use of eval (eval-used)</string>
<string>W: 27, 10: Use of eval (eval-used)</string>
<string>W:540, 13: Use of eval (eval-used)</string>
<string>W:595, 13: Use of eval (eval-used)</string>
<string>W:836, 13: Use of eval (eval-used)</string>
<string>W:1461, 13: Use of eval (eval-used)</string>
<string>W:1578, 13: Use of eval (eval-used)</string>
<string>W:1636, 13: Use of eval (eval-used)</string>
<string>W:1676, 13: Use of eval (eval-used)</string>
<string>W:2239, 13: Use of eval (eval-used)</string>
<string>W:2640, 13: Use of eval (eval-used)</string>
<string>W:2698, 13: Use of eval (eval-used)</string>
<string>W:2725, 13: Use of eval (eval-used)</string>
<string>W:2882, 13: Use of eval (eval-used)</string>
<string>W:2910, 13: Use of eval (eval-used)</string>
<string>W:2959, 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>
......
......@@ -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
......
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