Cleaning code

This commit is contained in:
Antonio de la Rosa 2025-12-03 22:21:25 +01:00
parent 8ca9038122
commit c59be2b698
43 changed files with 47 additions and 69 deletions

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero
@ -27,13 +27,10 @@ from cuchulu.libraries.keyutils import create_key
import traceback import traceback
from bottle import request from bottle import request
#from flask import request
#from werkzeug.utils import secure_filename
from uuid import uuid4 from uuid import uuid4
#from cuchulu.libraries.db.extraforms.fileform import FileForm
class FileField(CharField): class FileField(CharField):
"""Field for upload and save files in server""" """Field for upload and save files in server"""

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero
@ -24,8 +24,6 @@ from cuchulu.libraries.db.corefields import CharField
from cuchulu.libraries.db.extraforms.fileform import FileForm from cuchulu.libraries.db.extraforms.fileform import FileForm
from cuchulu.libraries.keyutils import create_key from cuchulu.libraries.keyutils import create_key
import traceback import traceback
#from flask import request
#from werkzeug.utils import secure_filename
from bottle import request from bottle import request
# from bottle import request # from bottle import request

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero
@ -19,11 +19,8 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """
#from cuchulu.libraries.db.webmodel import PhangoField
from cuchulu.libraries.db.corefields import IntegerField from cuchulu.libraries.db.corefields import IntegerField
from cuchulu.libraries.db.coreforms import SelectModelForm from cuchulu.libraries.db.coreforms import SelectModelForm
#from paramecio.citoplasma.httputils import GetPostFiles
#from flask import request
from bottle import request from bottle import request
class ParentField(IntegerField): class ParentField(IntegerField):

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -219,7 +219,7 @@ def ini_fields(fields):
def csrf_token(token_id='csrf_token'): def csrf_token(token_id='csrf_token'):
"""Function for generate a csrf token html hide form using flask sessions """Function for generate a csrf token html hide form using sessions plugin
Args: Args:
token_id (str): Name of the html hide form token_id (str): Name of the html hide form

View file

@ -12,7 +12,11 @@ if hasattr(config, 'email_failed'):
email_failed=config.email_failed email_failed=config.email_failed
class ErrorReportingPlugin(object): class ErrorReportingPlugin(object):
"""Bottle plugin for """ """Bottle plugin for send email if exception
A simple plugin that send an email to email_failed config variable with email address.
"""
name = 'error_reporting' name = 'error_reporting'
api = 2 api = 2

View file

@ -6,8 +6,11 @@ from settings import config
from bottle import request from bottle import request
def filterip(): def filterip():
#Check ip """Function for flter ip
ip = request.environ.get('REMOTE_ADDR')
"""
ip=request.environ.get('X-REAL-IP') or request.environ.get('HTTP_X_FORWARDED_FOR') or request.environ.get('REMOTE_ADDR')
if ip in config.allowed_ips: if ip in config.allowed_ips:

View file

@ -1,6 +1,6 @@
""" """
Cuchulu2fm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulu2fm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,7 +1,7 @@
""" """
Cuchulu2fm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulu2fm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2025 Antonio de la Rosa Caballero
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by it under the terms of the GNU Affero General Public License as published by

View file

@ -22,7 +22,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#import gettext #import gettext
from mako.template import Template from mako.template import Template
#from flask import url_for as url_for_flask
from mako.lookup import TemplateLookup from mako.lookup import TemplateLookup
from os import path from os import path
try: try:
@ -40,12 +39,6 @@ from cuchulu.libraries.db.formsutils import csrf_token
from cuchulu.libraries.sessionplugin import get_session from cuchulu.libraries.sessionplugin import get_session
from cuchulu.wsgiapp import app from cuchulu.wsgiapp import app
framework='flask'
if hasattr(config, 'framework'):
framework=config.framework
""" """
def _(text): def _(text):

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
Cuchulufm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulufm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,5 +1,5 @@
""" """
Cuchulu2fm is a series of wrappers for Flask, mako and others and construct a simple headless cms. Cuchulu2fm is a series of wrappers for bottle, mako and others and construct a simple headless cms.
Copyright (C) 2023 Antonio de la Rosa Caballero Copyright (C) 2023 Antonio de la Rosa Caballero

View file

@ -1,12 +1,10 @@
#from flask import Blueprint
from bottle import Bottle from bottle import Bottle
from cuchulu.libraries.mtemplates import PTemplate, env_theme from cuchulu.libraries.mtemplates import PTemplate, env_theme
from cuchulu.modules.admin.libraries.admin_auth import check_login from cuchulu.modules.admin.libraries.admin_auth import check_login
from cuchulu.libraries.plugins import DbPlugin from cuchulu.libraries.plugins import DbPlugin
from cuchulu.libraries.sessionplugin import SessionPlugin from cuchulu.libraries.sessionplugin import SessionPlugin
#admin_app=Blueprint('admin_app', __name__, static_folder='static')
admin_app=Bottle() admin_app=Bottle()
dbplugin=DbPlugin() dbplugin=DbPlugin()

View file

@ -1,5 +1,4 @@
from settings import config from settings import config
#from flask import g, url_for, session
from cuchulu.modules.admin.models.admin import UserAdmin from cuchulu.modules.admin.models.admin import UserAdmin
from cuchulu.libraries.generate_admin_class import GenerateAdminClass from cuchulu.libraries.generate_admin_class import GenerateAdminClass
from cuchulu.libraries.i18n import I18n, PGetText from cuchulu.libraries.i18n import I18n, PGetText

View file

@ -1,4 +1,3 @@
#from flask import Blueprint, redirect, session, url_for, request, g, make_response, abort
from settings import config from settings import config
from cuchulu.libraries.i18n import I18n, PGetText from cuchulu.libraries.i18n import I18n, PGetText
from cuchulu.libraries.datetime import now, format_local_strtime, timestamp_to_datetime, obtain_timestamp from cuchulu.libraries.datetime import now, format_local_strtime, timestamp_to_datetime, obtain_timestamp

View file

@ -1,4 +1,3 @@
#from flask import g, request, redirect, session, url_for
from cuchulu.libraries.db.webmodel import WebModel from cuchulu.libraries.db.webmodel import WebModel
from settings import config from settings import config
from cuchulu.libraries.db.extrafields.passwordfield import PasswordField from cuchulu.libraries.db.extrafields.passwordfield import PasswordField

View file

@ -7,19 +7,10 @@ from settings import config
from cuchulu.libraries.datetime import now, format_local_strtime, timestamp_to_datetime, obtain_timestamp from cuchulu.libraries.datetime import now, format_local_strtime, timestamp_to_datetime, obtain_timestamp
from cuchulu.libraries.keyutils import create_key_encrypt, create_key from cuchulu.libraries.keyutils import create_key_encrypt, create_key
from time import time from time import time
#from cuchulu.wsgiapp import app
#from cuchulu.modules.admin2 import admin_app
#from bottle import request, redirect, Bottle, response
#from flask import request, redirect
from bottle import request, redirect from bottle import request, redirect
#from cuchulu.modules.admin.libraries.loginplugin import check_login
#from cuchulu.libraries.sessionplugin import SessionPlugin
#from cuchulu.libraries.httputils import GetPostFiles
from cuchulu.libraries.db.formsutils import check_form, csrf_token from cuchulu.libraries.db.formsutils import check_form, csrf_token
from cuchulu.libraries.db.coreforms import PasswordForm from cuchulu.libraries.db.coreforms import PasswordForm
from cuchulu.libraries.sendmail import SendMail from cuchulu.libraries.sendmail import SendMail
from bottle import request
#from cuchulu.modules.admin.libraries.config import modules_admin
login_tries=5 login_tries=5