Commit 77226b9f authored by Nathalie Rousse's avatar Nathalie Rousse
Browse files

Adding activities log file / correction

parent 262bfe07
......@@ -5,6 +5,10 @@ Mixins common to erecord_vpz application views (activities)
"""
import datetime
from erecord_cmn.configs.config import LOG_ACT_FILE
from erecord_cmn.configs.config import LOG_ACT_ACTIVE
from rest_framework.response import Response
from django.http import Http404
from rest_framework.reverse import reverse
......@@ -278,13 +282,9 @@ class ActivityViewMixin(LimitedAccessViewMixin, RenderViewMixin,
options['report'] = report_option
return options
def to_log(url_txt, data) :
def to_log(self, url_txt, data) :
"""Records activity event into activity log file"""
import datetime
from erecord_cmn.configs.config import LOG_ACT_FILE
from erecord_cmn.configs.config import LOG_ACT_ACTIVE
if LOG_ACT_ACTIVE :
text = str(datetime.datetime.now())
text += " -R- " + url_txt
......@@ -548,6 +548,7 @@ class InputViewMixin(ActivityViewMixin, LimitedAccessVpzInputViewMixin):
"""action done for a GET request about input of a vpz"""
try :
self.to_log("GET vpz/input", data)
res = self.init_activity(LOGGER=LOGGER, data=data)
except :
raise
......@@ -563,6 +564,7 @@ class InputViewMixin(ActivityViewMixin, LimitedAccessVpzInputViewMixin):
"""action done for a POST request about input of a vpz"""
try :
self.to_log("POST vpz/input", data)
res = self.init_activity(LOGGER=LOGGER, data=data)
except :
raise
......@@ -587,6 +589,7 @@ class OutputViewMixin(DataFolderViewMixin, ActivityViewMixin):
"""
try :
self.to_log("GET vpz/output", data)
res = self.init_activity(LOGGER=LOGGER, data=data)
except :
raise
......@@ -609,6 +612,7 @@ class OutputViewMixin(DataFolderViewMixin, ActivityViewMixin):
"""
try :
self.to_log("POST vpz/output", data)
res = self.init_activity(LOGGER=LOGGER, data=data)
except :
raise
......@@ -644,6 +648,7 @@ class InOutputViewMixin(DataFolderViewMixin, ActivityViewMixin):
"""
try :
self.to_log("GET vpz/inout", data)
res = self.init_activity(LOGGER=LOGGER, data=data)
except :
raise
......@@ -671,6 +676,7 @@ class InOutputViewMixin(DataFolderViewMixin, ActivityViewMixin):
"""
try :
self.to_log("POST vpz/inout", data)
res = self.init_activity(LOGGER=LOGGER, data=data)
except :
raise
......
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