def post(self):
        call_type = self.request.get('call', 'calculate')
        if not self.is_valid_input(call_type, HOME_CALL_TYPE):
            return self.render_json({'error': ERROR_INVALID_PARAM % 'call'})

        if call_type == 'calculate':
            calculation_object = self.request.get('cal_obj', '')
            do_logging(calculation_object)
            value = None
            error = None

            try:
                value = eval(calculation_object)
            except SyntaxError:
                do_logging(traceback.format_exc())
                error = "Invalid Syntax"

            if not error:
                Logs.add_obj(**{'user_name': self.request.cookies.get('user', 'random'),
                                'cal_obj': calculation_object + " = %s" % value,
                                'call_ip': self.request.remote_addr})
            return self.render_json({'error': error,
                                     'value': value,
                                     'cal': calculation_object})

        elif call_type == 'logs':
            cursor = self.request.get('cursor', '')
            logs = Logs.get_logs(cursor)
            return self.render_json(logs)
 def get(self):
     logs = Logs.get_logs()
     template = JINJA_ENVIRONMENT.get_template(TEMPLATE_FOLDER + '/' + 'index.html')
     self.response.write(template.render(**logs))