diff --git a/paramecio/citoplasma/httputils.py b/paramecio/citoplasma/httputils.py index 8eeeb83..96eb16f 100644 --- a/paramecio/citoplasma/httputils.py +++ b/paramecio/citoplasma/httputils.py @@ -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 diff --git a/paramecio/citoplasma/mtemplates.py b/paramecio/citoplasma/mtemplates.py index 7e71043..476dc55 100644 --- a/paramecio/citoplasma/mtemplates.py +++ b/paramecio/citoplasma/mtemplates.py @@ -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): diff --git a/paramecio/cromosoma/extrafields/datefield.py b/paramecio/cromosoma/extrafields/datefield.py index 6fd782a..36d3c3b 100644 --- a/paramecio/cromosoma/extrafields/datefield.py +++ b/paramecio/cromosoma/extrafields/datefield.py @@ -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): diff --git a/paramecio/cromosoma/webmodel.py b/paramecio/cromosoma/webmodel.py index 1be5ce9..0a9d42c 100644 --- a/paramecio/cromosoma/webmodel.py +++ b/paramecio/cromosoma/webmodel.py @@ -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: