domain: fix smileys

This commit is contained in:
Cyrille L 2022-11-21 17:06:46 +01:00
parent 0ee4994d3f
commit f4fbb825db
1 changed files with 24 additions and 38 deletions

View File

@ -90,7 +90,7 @@ def append_f(f,line_val):
#--------------------------------------# #--------------------------------------#
def exiting(process,out,msg): def exiting(process,out,msg):
msgs = [ msgs = [
'\n:) All done !', '\n:D All done !',
'\n:/ Maybe next time...', '\n:/ Maybe next time...',
'%s'%msg '%s'%msg
] ]
@ -133,9 +133,9 @@ def manage_domain(Domain, Opt):
# Compare before and after domain conf file # Compare before and after domain conf file
new_conf_ID = check.get_filesum(domain_conf,True) new_conf_ID = check.get_filesum(domain_conf,True)
if not old_conf_ID == new_conf_ID: if not old_conf_ID == new_conf_ID:
exiting('root',2,':) Updated domain configuration file.') exiting('root',2,':D Updated domain configuration file.')
else: else:
exiting('root',2,':) Unchanged domain configuration file.') exiting('root',2,':D Unchanged domain configuration file.')
else: else:
sys.exit(0) sys.exit(0)
@ -222,10 +222,8 @@ def domain_input_confirn(set_domain):
def domain_input(): def domain_input():
global domain_name global domain_name
set_domain = input(' ├ Enter Domain Name: ') set_domain = input(' ├ Enter Domain Name: ')
if not set_domain: if not set_domain: exiting('root', 1, '')
exiting('root',1,'') else : domain_name = set_domain
else:
domain_name = set_domain
#====================# #====================#
# Domain FORM # # Domain FORM #
@ -274,7 +272,7 @@ def domain_form():
srv = set_srv[:-1] srv = set_srv[:-1]
if not os.path.exists(srv): if not os.path.exists(srv):
exiting('form',2,'\n:( Unsed directory "%s"'%srv) exiting('form',2,'\n:< Unsed directory "%s"'%srv)
# Settings for server # Settings for server
srv_domain = '%s/%s/'%(srv,domain_name) srv_domain = '%s/%s/'%(srv,domain_name)
@ -330,7 +328,7 @@ def domain_form():
set_sep = input(' ├ Website pages separator (%s) ? '%sep_titles) set_sep = input(' ├ Website pages separator (%s) ? '%sep_titles)
if set_sep: if set_sep:
if len(set_sep) > 2: if len(set_sep) > 2:
exiting('form',2,'\n:( Seperator is 2 characters max') exiting('form', 2, '\n:< Seperator is 2 characters max')
sep_titles = set_sep sep_titles = set_sep
append_f(temp_domain,'sep_titles = "%s"'%sep_titles) append_f(temp_domain,'sep_titles = "%s"'%sep_titles)
@ -345,12 +343,9 @@ def domain_form():
domain_about = show_about = '' domain_about = show_about = ''
set_about = input(' ├ Domain description (%s) ? '%show_about) set_about = input(' ├ Domain description (%s) ? '%show_about)
if not set_about and not domain_about: if not set_about and not domain_about: exiting('form',1,'')
exiting('form',1,'') if set_about: domain_about = set_about
if set_about: if '"' in domain_about: domain_about = domain_about.replace('"','\\"')
domain_about = set_about
if '"' in domain_about:
domain_about = domain_about.replace('"','\\"')
append_f(temp_domain,'domain_about = "%s"'%domain_about) append_f(temp_domain,'domain_about = "%s"'%domain_about)
@ -367,7 +362,7 @@ def domain_form():
set_lang = input(' ├ Website HTML lang (%s) ? '%domain_lang) set_lang = input(' ├ Website HTML lang (%s) ? '%domain_lang)
if set_lang: if set_lang:
if len(set_lang) > 3: if len(set_lang) > 3:
exiting('form',2,'\n:( HTML Lang is 3 characters max') exiting('form',2,'\n:< HTML Lang is 3 characters max')
domain_lang = set_lang domain_lang = set_lang
append_f(temp_domain,'domain_lang = "%s"'%domain_lang) append_f(temp_domain,'domain_lang = "%s"'%domain_lang)
@ -399,14 +394,13 @@ def domain_form():
domain_mail = show_mail = '' domain_mail = show_mail = ''
set_mail = input(' ├ Contact admin mail (%s) ? '%show_mail) set_mail = input(' ├ Contact admin mail (%s) ? '%show_mail)
if not set_mail and not domain_mail: if not set_mail and not domain_mail: exiting('form', 1, '')
exiting('form',1,'')
if set_mail: if set_mail:
if not '@' and not '.' in set_mail: if not '@' and not '.' in set_mail:
exiting('form',2,'\n:( Invalid mail format (x@x.x)') exiting('form', 2, '\n:< Invalid mail format (x@x.x)')
domain_mail = set_mail domain_mail = set_mail
elif not domain_mail: elif not domain_mail:
exiting('form',2,'\n:( Mail is required.') exiting('form', 2, '\n:< Mail is required.')
append_f(temp_domain,'domain_mail = "%s"'%domain_mail) append_f(temp_domain,'domain_mail = "%s"'%domain_mail)
@ -420,10 +414,8 @@ def domain_form():
domain_tags = show_tags = '' domain_tags = show_tags = ''
set_tags = input(' ├ Domain Tags [x,y] (%s) ? '%show_tags) set_tags = input(' ├ Domain Tags [x,y] (%s) ? '%show_tags)
if not set_tags and not domain_tags: if not set_tags and not domain_tags: exiting('form', 1, '')
exiting('form',1,'') if set_tags: domain_tags = set_tags
if set_tags:
domain_tags = set_tags
append_f(temp_domain,'domain_tags = "%s"'%domain_tags) append_f(temp_domain,'domain_tags = "%s"'%domain_tags)
@ -437,8 +429,7 @@ def domain_form():
domain_license = show_license = 'CC BY-NC-SA' domain_license = show_license = 'CC BY-NC-SA'
set_license = input(' ├ Website copyright (%s) ? '%show_license) set_license = input(' ├ Website copyright (%s) ? '%show_license)
if set_license: if set_license: domain_license = set_license
domain_license = set_license
if '"' in domain_license: if '"' in domain_license:
domain_license = domain_license.replace('"','\\"') domain_license = domain_license.replace('"','\\"')
@ -451,14 +442,11 @@ def domain_form():
sidebar_title sidebar_title
show_st = sidebar_title[:14] + '...' show_st = sidebar_title[:14] + '...'
except: except:
if 'fr' in domain_lang: if 'fr' in domain_lang: sidebar_title = show_st = "À l'affiche !"
sidebar_title = show_st = "À l'affiche !" else : sidebar_title = show_st = "Featured !"
else:
sidebar_title = show_st = "Featured !"
set_st = input(' ├ Sidebar title (%s) ? '%show_st) set_st = input(' ├ Sidebar title (%s) ? '%show_st)
if set_st: if set_st: sidebar_title = set_st
sidebar_title = set_st
if '"' in sidebar_title: if '"' in sidebar_title:
sidebar_title = sidebar_title.replace('"','\\"') sidebar_title = sidebar_title.replace('"','\\"')
@ -473,7 +461,7 @@ def domain_form():
set_si = input(' ├ Sidebar max items [1-16] (%s) ? '%sidebar_items) set_si = input(' ├ Sidebar max items [1-16] (%s) ? '%sidebar_items)
if set_si and set_si.isdigit(): if set_si and set_si.isdigit():
if set_si in range(1,16): if set_si in range(1,16):
exiting('form',2,'\n:( Items number: 1-16') exiting('form',2,'\n:< Items number: 1-16')
sidebar_items = set_si sidebar_items = set_si
# Domain LOGO (optional) # Domain LOGO (optional)
@ -486,8 +474,7 @@ def domain_form():
domain_logo = show_logo = '' domain_logo = show_logo = ''
set_logo = input(' ├ Optional. Logo filename (%s) ? '%show_logo) set_logo = input(' ├ Optional. Logo filename (%s) ? '%show_logo)
if set_logo: if set_logo: domain_logo = set_logo
domain_logo = set_logo
append_f(temp_domain,'domain_logo = "%s"'%domain_logo) append_f(temp_domain,'domain_logo = "%s"'%domain_logo)
# External URL profile (optional) # External URL profile (optional)
@ -500,8 +487,7 @@ def domain_form():
domain_exturl = show_e = '' domain_exturl = show_e = ''
set_e = input(' └ Optionnal. URL to a social network (%s) ? '%show_e) set_e = input(' └ Optionnal. URL to a social network (%s) ? '%show_e)
if set_e: if set_e: domain_exturl = set_e
domain_exturl = set_e
append_f(temp_domain,'domain_exturl = "%s"'%domain_exturl) append_f(temp_domain,'domain_exturl = "%s"'%domain_exturl)
@ -533,6 +519,6 @@ def create_domain():
check.create_domain_dirs('all') check.create_domain_dirs('all')
# Will rename temp_domain conf to legacy domain conf file # Will rename temp_domain conf to legacy domain conf file
exiting('form',2,'\n:) Activated domain: "%s"'%domain_name) exiting('form',2,'\n:D Activated domain: "%s"'%domain_name)