Permalink
Browse files

v0.92, add proc_set_res, no more service restart on admin/system

  • Loading branch information...
nopri committed Oct 22, 2012
1 parent 1bb247b commit 61506e9c3bb05aba190e830943fd011994c1b356
Showing with 41 additions and 44 deletions.
  1. +41 −29 app.py
  2. +0 −2 messages.py
  3. +0 −13 template/default/admin_system.html
View
70 app.py
@@ -215,10 +215,11 @@ def pget(option, default='', strip=True, callback=None):
#
return ret
+
############################### CONSTANT ###############################
-VERSION = '0.91'
+VERSION = '0.92'
NAME = 'onlinestore-multi'
PRECISION = 2
TEMPLATE_DIR = CURDIR + PS + 'template'
@@ -282,39 +283,14 @@ def pget(option, default='', strip=True, callback=None):
'max_file_size' : 600 * 1024,
'max_files' : 600,
}
-for _rk in res.keys():
- if _rk in res_fix: continue
- _rt = pget(_rk).lower()
- _rtv = ''
- if _rk == 'promote':
- _rtv = False
- if _rt == '1':
- _rtv = True
- elif _rk == 'payments':
- if _rt.find(',') > 0:
- try:
- _rtv = [x for x in _rt.split(',')]
- _rtv.remove('')
- _rtv = [int(x) for x in _rtv]
- except:
- _rtv = res['payments']
- else:
- try:
- _rtv = int(_rt)
- except:
- pass
- #
- if type(_rtv) in [type(True), type(0), type([])]: res[_rk] = _rtv
-#
-#
-
-rendertime = [0, 0]
-
#quick hack as of 18-October-2012
FORCE_PROMOTE = res['promote']
PAYMENT_TYPE = res['payments']
+rendertime = [0, 0]
+
+
############################### FUNCTION ###############################
def is_valid_email(email):
@@ -2172,7 +2148,43 @@ def proc_set_fullpath(handle):
return handle()
+def proc_set_res(handle):
+ global res
+ global FORCE_PROMOTE
+ global PAYMENT_TYPE
+ #
+ for _rk in res.keys():
+ if _rk in res_fix: continue
+ _rt = pget(_rk).lower()
+ _rtv = ''
+ if _rk == 'promote':
+ _rtv = False
+ if _rt == '1':
+ _rtv = True
+ elif _rk == 'payments':
+ if _rt.find(',') > 0:
+ try:
+ _rtv = [x for x in _rt.split(',')]
+ _rtv.remove('')
+ _rtv = [int(x) for x in _rtv]
+ except:
+ _rtv = res['payments']
+ else:
+ try:
+ _rtv = int(_rt)
+ except:
+ pass
+ #
+ if type(_rtv) in [type(True), type(0), type([])]: res[_rk] = _rtv
+ #
+ FORCE_PROMOTE = res['promote']
+ PAYMENT_TYPE = res['payments']
+ #
+ return handle()
+
+
wapp.add_processor(proc_calc_render_start)
+wapp.add_processor(proc_set_res)
wapp.add_processor(proc_detect_ua)
wapp.add_processor(proc_set_lang)
wapp.add_processor(proc_set_log)
View
@@ -428,7 +428,6 @@
'desc_sys_template' : '',
'desc_sys_logo_file' : '',
'desc_sys_news_max' : 'empty for all news',
- 'desc_sys_needs_restart': 'needs server restart',
'desc_sys_payments': 'comma separated/ended: 1=cash, 2=cod, 3=bank/wire transfer',
'desc_sys_domain': 'tanpa protokol http/https',
'desc_product_category_priority': 'descending sort',
@@ -873,7 +872,6 @@
'desc_sys_template' : '',
'desc_sys_logo_file' : '',
'desc_sys_news_max' : 'kosongkan untuk tampil semua',
- 'desc_sys_needs_restart': 'butuh restart server',
'desc_sys_payments': 'dipisahkan/diakhiri koma: 1=cash, 2=cod, 3=transfer bank',
'desc_sys_domain': 'tanpa protokol http/https',
'desc_product_category_priority': 'besar ke kecil',
@@ -242,7 +242,6 @@ <h3><a href="$ub('/admin')">$msg['title_admin'].capitalize()</a>&nbsp; &rarr; &n
<td width='20%' valign='top'>
$msg['header_sys_domain'].capitalize()
$:dkget(msg, 'desc_sys_domain', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
- $:dkget(msg, 'desc_sys_needs_restart', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
</td>
<td>
<input type='text' name='domain' size='4' value="$data['domain']">
@@ -253,7 +252,6 @@ <h3><a href="$ub('/admin')">$msg['title_admin'].capitalize()</a>&nbsp; &rarr; &n
<td width='20%' valign='top'>
$msg['header_sys_promote'].capitalize()
$:dkget(msg, 'desc_sys_promote', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
- $:dkget(msg, 'desc_sys_needs_restart', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
</td>
<td>
<input type='text' name='promote' size='4' value="$data['promote']">
@@ -264,7 +262,6 @@ <h3><a href="$ub('/admin')">$msg['title_admin'].capitalize()</a>&nbsp; &rarr; &n
<td width='20%' valign='top'>
$msg['header_sys_payments'].capitalize()
$:dkget(msg, 'desc_sys_payments', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
- $:dkget(msg, 'desc_sys_needs_restart', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
</td>
<td>
<input type='text' name='payments' size='4' value="$data['payments']">
@@ -275,7 +272,6 @@ <h3><a href="$ub('/admin')">$msg['title_admin'].capitalize()</a>&nbsp; &rarr; &n
<td width='20%' valign='top'>
$msg['header_sys_max_product_category'].capitalize()
$:dkget(msg, 'desc_sys_max_product_category', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
- $:dkget(msg, 'desc_sys_needs_restart', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
</td>
<td>
<input type='text' name='max_product_category' size='4' value="$data['max_product_category']">
@@ -286,7 +282,6 @@ <h3><a href="$ub('/admin')">$msg['title_admin'].capitalize()</a>&nbsp; &rarr; &n
<td width='20%' valign='top'>
$msg['header_sys_max_product'].capitalize()
$:dkget(msg, 'desc_sys_max_product', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
- $:dkget(msg, 'desc_sys_needs_restart', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
</td>
<td>
<input type='text' name='max_product' size='4' value="$data['max_product']">
@@ -297,7 +292,6 @@ <h3><a href="$ub('/admin')">$msg['title_admin'].capitalize()</a>&nbsp; &rarr; &n
<td width='20%' valign='top'>
$msg['header_sys_max_file_size'].capitalize()
$:dkget(msg, 'desc_sys_max_file_size', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
- $:dkget(msg, 'desc_sys_needs_restart', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
</td>
<td>
<input type='text' name='max_file_size' size='4' value="$data['max_file_size']">
@@ -308,7 +302,6 @@ <h3><a href="$ub('/admin')">$msg['title_admin'].capitalize()</a>&nbsp; &rarr; &n
<td width='20%' valign='top'>
$msg['header_sys_max_files'].capitalize()
$:dkget(msg, 'desc_sys_max_files', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
- $:dkget(msg, 'desc_sys_needs_restart', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
</td>
<td>
<input type='text' name='max_files' size='4' value="$data['max_files']">
@@ -319,7 +312,6 @@ <h3><a href="$ub('/admin')">$msg['title_admin'].capitalize()</a>&nbsp; &rarr; &n
<td width='20%' valign='top'>
$msg['header_sys_mail_smtp'].capitalize()
$:dkget(msg, 'desc_sys_mail_smtp', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
- $:dkget(msg, 'desc_sys_needs_restart', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
</td>
<td>
<input type='text' name='mail_smtp' size='4' value="$data['mail_smtp']">
@@ -330,7 +322,6 @@ <h3><a href="$ub('/admin')">$msg['title_admin'].capitalize()</a>&nbsp; &rarr; &n
<td width='20%' valign='top'>
$msg['header_sys_mail_user'].capitalize()
$:dkget(msg, 'desc_sys_mail_user', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
- $:dkget(msg, 'desc_sys_needs_restart', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
</td>
<td>
<input type='text' name='mail_user' size='4' value="$data['mail_user']">
@@ -341,7 +332,6 @@ <h3><a href="$ub('/admin')">$msg['title_admin'].capitalize()</a>&nbsp; &rarr; &n
<td width='20%' valign='top'>
$msg['header_sys_mail_pass'].capitalize()
$:dkget(msg, 'desc_sys_mail_pass', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
- $:dkget(msg, 'desc_sys_needs_restart', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
</td>
<td>
<input type='text' name='mail_pass' size='4' value="$data['mail_pass']">
@@ -352,7 +342,6 @@ <h3><a href="$ub('/admin')">$msg['title_admin'].capitalize()</a>&nbsp; &rarr; &n
<td width='20%' valign='top'>
$msg['header_sys_mail_default'].capitalize()
$:dkget(msg, 'desc_sys_mail_default', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
- $:dkget(msg, 'desc_sys_needs_restart', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
</td>
<td>
<input type='text' name='mail_default' size='4' value="$data['mail_default']">
@@ -363,7 +352,6 @@ <h3><a href="$ub('/admin')">$msg['title_admin'].capitalize()</a>&nbsp; &rarr; &n
<td width='20%' valign='top'>
$msg['header_sys_url_base'].capitalize()
$:dkget(msg, 'desc_sys_url_base', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
- $:dkget(msg, 'desc_sys_needs_restart', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
</td>
<td>
<input type='text' name='url_base' size='4' value="$data['url_base']">
@@ -374,7 +362,6 @@ <h3><a href="$ub('/admin')">$msg['title_admin'].capitalize()</a>&nbsp; &rarr; &n
<td width='20%' valign='top'>
$msg['header_sys_font_dir'].capitalize()
$:dkget(msg, 'desc_sys_font_dir', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
- $:dkget(msg, 'desc_sys_needs_restart', "&nbsp;<span class='systeminfo'>(", ')</span>&nbsp;')</span>
</td>
<td>
<input type='text' name='font_dir' size='4' value="$data['font_dir']">

0 comments on commit 61506e9

Please sign in to comment.