Deprecating modules

This commit is contained in:
Antonio de la Rosa 2025-03-04 00:40:44 +01:00
parent 81847b6e00
commit eb91ef59bd
5 changed files with 31 additions and 19 deletions

View file

@ -1,10 +1,12 @@
from paramecio.libraries.i18n import I18n
from bottle import get,response,request
from paramecio.libraries.sessions import get_session
#from paramecio.libraries.sessions import get_session
from paramecio.libraries.sessionplugin import get_session, session_plugin
from paramecio.libraries.urls import redirect
import re
@get('/change_lang/<lang>')
@session_plugin
def index(lang):
if lang in I18n.dict_i18n:
@ -12,8 +14,7 @@ def index(lang):
s=get_session()
s['lang']=lang
s.save()
#s.save()
redirect_url=request.headers.get('Referer')
@ -23,5 +24,7 @@ def index(lang):
redirect(redirect_url)
return ""
return {'error': 1, 'message': 'No referer for redirect'}

View file

@ -0,0 +1,3 @@
from bottle import Bottle
welcome_app=Bottle()

View file

@ -4,25 +4,27 @@ from paramecio.libraries.mtemplates import PTemplate, env_theme
from paramecio.libraries.urls import make_url
from paramecio.wsgiapp import app
from settings import config
from paramecio.modules.welcome import welcome_app
from bottle import request
#t=ptemplate(__file__)
env=env_theme(__file__)
t=PTemplate(env)
@app.route('/welcome')
@welcome_app.route('/welcome')
def home():
return t.render_template('welcome.html', title="Welcome to Paramecio!!!", content="The simple web framework writed in Python3!!!")
@app.route('/welcome/<id:int>')
@welcome_app.route('/welcome/<id:int>')
def page(id):
return t.render_template('index.html', title="A simple example of a page", id=id, value=request.query.value)
@app.route('/welcome/test/<int_id:int>')
@welcome_app.route('/welcome/test/<int_id:int>')
def test(int_id):
return make_url('welcome/test/'+int_id, {'ohmygod': 'This is gooood', 'shutup':'Shut up!!'})
return make_url(f'welcome/test/{int_id}', {'ohmygod': 'This is gooood', 'shutup':'Shut up!!'})
if config.default_module=="welcome":