Little silly fixes in text
This commit is contained in:
parent
27b1dc5386
commit
348b506755
5 changed files with 41 additions and 9 deletions
|
|
@ -19,11 +19,15 @@ class GetPostFiles:
|
||||||
GetPostFiles.get=request.query.decode()
|
GetPostFiles.get=request.query.decode()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def obtain_post():
|
def obtain_post(required_post=[]):
|
||||||
|
|
||||||
GetPostFiles.post={}
|
GetPostFiles.post={}
|
||||||
|
|
||||||
GetPostFiles.post=request.forms.decode()
|
GetPostFiles.post=request.forms.decode()
|
||||||
|
|
||||||
|
for post in required_post:
|
||||||
|
|
||||||
|
GetPostFiles.post[post]=GetPostFiles.post.get(post, '')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def obtain_files():
|
def obtain_files():
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,11 @@ class PasswordField(PhangoField):
|
||||||
return ""
|
return ""
|
||||||
else:
|
else:
|
||||||
|
|
||||||
self.txt_error="The value is empty"
|
self.txt_error="The field is empty"
|
||||||
self.error=True
|
self.error=True
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.txt_error="The value is empty"
|
self.txt_error="The field is empty"
|
||||||
self.error=True
|
self.error=True
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
@ -46,4 +46,4 @@ class PasswordField(PhangoField):
|
||||||
|
|
||||||
return bcrypt.verify(password, h)
|
return bcrypt.verify(password, h)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
from paramecio.cromosoma import corefields
|
from paramecio.cromosoma import corefields
|
||||||
|
from paramecio.cromosoma.coreforms import PasswordForm
|
||||||
|
from paramecio.citoplasma.i18n import I18n
|
||||||
from bottle import request
|
from bottle import request
|
||||||
|
|
||||||
# Need unittest
|
# Need unittest
|
||||||
|
|
@ -38,9 +40,24 @@ def show_form(post, arr_form, t, yes_error=True, modelform_tpl='forms/modelform.
|
||||||
|
|
||||||
return t.load_template(modelform_tpl, forms=arr_form)
|
return t.load_template(modelform_tpl, forms=arr_form)
|
||||||
|
|
||||||
|
#Simple Function for add repeat_password form to user model
|
||||||
|
|
||||||
|
def set_extra_forms_user(user_admin):
|
||||||
|
|
||||||
|
user_admin.fields['password'].required=True
|
||||||
|
user_admin.fields['email'].required=True
|
||||||
|
|
||||||
|
user_admin.create_forms(['username', 'email', 'password'])
|
||||||
|
|
||||||
|
user_admin.forms['repeat_password']=PasswordForm('repeat_password', '')
|
||||||
|
|
||||||
|
user_admin.forms['repeat_password'].required=True
|
||||||
|
|
||||||
|
user_admin.forms['repeat_password'].label=I18n.lang('common', 'repeat_password', 'Repeat Password')
|
||||||
|
|
||||||
#Function for initial values for necessary fields.
|
#Function for initial values for necessary fields.
|
||||||
|
|
||||||
def ini_fields(fields):
|
def ini_fields(fields):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -801,6 +801,17 @@ class WebModel:
|
||||||
|
|
||||||
self.forms=new_dict
|
self.forms=new_dict
|
||||||
|
|
||||||
|
def show_errors(self):
|
||||||
|
|
||||||
|
error_txt=''
|
||||||
|
|
||||||
|
for k_error in self.fields_errors.values():
|
||||||
|
|
||||||
|
for error in k_error:
|
||||||
|
error_txt+=error+"\n"
|
||||||
|
|
||||||
|
return error_txt
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def close():
|
def close():
|
||||||
WebModel.make_connection=SqlClass.connect_to_db
|
WebModel.make_connection=SqlClass.connect_to_db
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ from settings import config_admin
|
||||||
from paramecio.citoplasma.lists import SimpleList
|
from paramecio.citoplasma.lists import SimpleList
|
||||||
from paramecio.citoplasma.generate_admin_class import GenerateAdminClass
|
from paramecio.citoplasma.generate_admin_class import GenerateAdminClass
|
||||||
from paramecio.citoplasma.httputils import GetPostFiles
|
from paramecio.citoplasma.httputils import GetPostFiles
|
||||||
from paramecio.cromosoma.formsutils import show_form, pass_values_to_form
|
from paramecio.cromosoma.formsutils import show_form, pass_values_to_form, set_extra_forms_user
|
||||||
from paramecio.cromosoma.coreforms import PasswordForm
|
from paramecio.cromosoma.coreforms import PasswordForm
|
||||||
from importlib import import_module, reload
|
from importlib import import_module, reload
|
||||||
from bottle import redirect
|
from bottle import redirect
|
||||||
|
|
@ -304,7 +304,7 @@ def logout():
|
||||||
|
|
||||||
redirect('/'+config.admin_folder)
|
redirect('/'+config.admin_folder)
|
||||||
|
|
||||||
|
"""
|
||||||
def set_extra_forms_user(user_admin):
|
def set_extra_forms_user(user_admin):
|
||||||
|
|
||||||
user_admin.fields['password'].required=True
|
user_admin.fields['password'].required=True
|
||||||
|
|
@ -317,10 +317,10 @@ def set_extra_forms_user(user_admin):
|
||||||
user_admin.forms['repeat_password'].required=1
|
user_admin.forms['repeat_password'].required=1
|
||||||
|
|
||||||
user_admin.forms['repeat_password'].label=I18n.lang('common', 'repeat_password', 'Repeat Password')
|
user_admin.forms['repeat_password'].label=I18n.lang('common', 'repeat_password', 'Repeat Password')
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
"""user_admin.create_forms()
|
||||||
"""user_admin.create_forms()
|
|
||||||
|
|
||||||
users=user_admin.select()"""
|
users=user_admin.select()"""
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue