Fix in many things

This commit is contained in:
Antonio de la Rosa 2017-10-24 20:00:50 +02:00
parent fa536032f1
commit aec95e2440
4 changed files with 14 additions and 4 deletions

View file

@ -4,6 +4,7 @@ import json, re
from bottle import request, response
from paramecio.citoplasma.sessions import get_session
from paramecio.citoplasma.keyutils import create_key_encrypt
from bottle import HTTPResponse
no_csrf=False
change_csrf=False
@ -105,7 +106,8 @@ class GetPostFiles:
if self.post['csrf_token']!=s['csrf_token'] or self.post['csrf_token'].strip()=="":
raise NameError('Error: you need a valid csrf_token')
#raise NameError('Error: you need a valid csrf_token')
raise HTTPResponse(body=json.dumps({'error_csrf': 1, 'error': 1}), status=200, headers={'Content-type': 'application/json'})
else:
#Clean csrf_token
@ -117,7 +119,8 @@ class GetPostFiles:
else:
raise NameError('Error: you don\'t send any valid csrf_token')
#raise NameError('Error: you don\'t send any valid csrf_token')
raise HTTPResponse(body=json.dumps({'error_csrf': 1, 'error': 1}), status=200, headers={'Content-type': 'application/json'})
#Check post_token

View file

@ -222,6 +222,13 @@ class PTemplate:
self.filters[filter_name.__name__]=filter_name
class STemplate:
def __init__(html_code):
return Template(html_code)
class HeaderHTML:
def __init__(self):

View file

@ -12,7 +12,7 @@ class DateField(PhangoField):
self.utc=True
self.error_default='Date format invalid'
self.error_default='Error: Date format invalid'
def check(self, value):

View file

@ -818,7 +818,7 @@ class WebModel:
conditions[0]+=" AND `"+table_name+"`.`"+self.fields[field].identifier_field+"`=`"+self.name+"`.`"+field+"`"
sql= "select count(`"+field_to_count+"`) from "+", ".join(tables_to_select)+' '+conditions[0]
print(sql)
count=0
with self.query(sql, conditions[1], self.connection_id) as cursor: