def log_event(action, code = 0, email = None, info = None): if email is None: user = users.get_current_user() if user is None: email = None else: email = user.email() event = Event(author=email, action = action, code = code, info = info) event.save()
def log_event(action, code = 0, email = None, info = None): if email is None: user = users.get_current_user() if user is None: email = None else: email = user.email() domain = os.environ['SERVER_NAME'] event = Event(author=email, action = action, code = code, info = info, domain=domain) event.save()
def log_event(action, code=0, email=None, info=None): if email is None: user = users.get_current_user() if user is None: email = None else: email = user.email() domain = os.environ['SERVER_NAME'] event = Event(author=email, action=action, code=code, info=info, domain=domain) event.save()
def events_flusher(self): domain = os.environ['SERVER_NAME'] deleted = Event.clear(False, 1000, domain=domain) done = deleted<1000 log_event("Removed all events") message = 'removed %d event(s)' % deleted if not done: message += ' ...' return self.render_json_response({ 'finished': done, 'message': message })
def events_flusher(self): domain = os.environ['SERVER_NAME'] deleted = Event.clear(False, 1000, domain=domain) done = deleted < 1000 log_event("Removed all events") message = 'removed %d event(s)' % deleted if not done: message += ' ...' return self.render_json_response({ 'finished': done, 'message': message })
def events(self): offset = int(self.params.get("offset", 0)) limit = int(self.params.get("limit", 50)) events = Event.all().filter( "domain =", os.environ['SERVER_NAME']).order('-date').fetch(limit, offset) res = [] for e in events: res.append({ "author": unicode(e.author), "action": unicode(e.action), "info": unicode(e.info), "code": e.code, "date": e.date }) return self.render_json_response({'status': 0, 'data': res})
def events(self): offset = int(self.params.get("offset", 0)) limit = int(self.params.get("limit", 50)) events = Event.all().filter("domain =", os.environ['SERVER_NAME']).order('-date').fetch(limit, offset) res = [] for e in events: res.append({ "author": unicode(e.author), "action": unicode(e.action), "info": unicode(e.info), "code": e.code, "date": e.date }) return self.render_json_response({ 'status': 0, 'data': res })