[cpif] r407 - trunk/frontend-web
svn at argo.es
svn at argo.es
Fri Oct 19 07:14:10 CEST 2007
Author: jcea
Date: Fri Oct 19 07:14:10 2007
New Revision: 407
Log:
Podemos ver y cambiar la zona horaria por defecto del servidor
Modified:
trunk/frontend-web/url_edit_config.py
trunk/frontend-web/url_edit_config_POST.py
Modified: trunk/frontend-web/url_edit_config.py
==============================================================================
--- trunk/frontend-web/url_edit_config.py (original)
+++ trunk/frontend-web/url_edit_config.py Fri Oct 19 07:14:10 2007
@@ -31,6 +31,7 @@
texto.append('<tr><td>Allow HTML?</td><td><input type="checkbox" name="allow_html" %s /></td></tr>' % ("CHECKED" if globales.allow_html else ""))
texto.append('<tr><td>Allow avatar change<br/>(Requires library. See docs)</td><td><input type="checkbox" name="allow_avatar_change" %s /></td></tr>' % ("CHECKED" if globales.allow_avatar_change else ""))
texto.append('<tr><td>Base URL for this service<br/>(<b>DO NOT</b> write down the last slash)</td><td><input type="text" name="base_url" size="50" value="%s" /></td><tr>' %globales.base_url)
+ texto.append('<tr><td>TimeZone [<a href="http://www.timezoneconverter.com/">?</a>]</td><td><input type="text" name="tz" size="30" value="%s" /></td></tr>' %globales.tz)
texto.append('<tr><td>Outgoing SMTP server</td><td><input type="text" name="smtp_server" size="30" value="%s" /></td><tr>' %globales.smtp_server)
texto.append('<tr><td>Outgoing SMTP server port</td><td><input type="text" name="smtp_server_port" size="5" value="%d" /></td></tr>' %globales.smtp_server_port)
texto.append('<tr><td>SMTP sender address</td><td><input type="text" name="smtp_email_sender" size="30" value="%s" /></td><tr>' %globales.smtp_email_sender)
Modified: trunk/frontend-web/url_edit_config_POST.py
==============================================================================
--- trunk/frontend-web/url_edit_config_POST.py (original)
+++ trunk/frontend-web/url_edit_config_POST.py Fri Oct 19 07:14:10 2007
@@ -36,6 +36,22 @@
else :
return None # Error!!
# conf.clear() # Don't need "clear", since keys are overwritten
+
+ tz=new_conf["tz"]
+ if conf["tz"]!=tz :
+ try :
+ import pytz
+ pytz.timezone(tz) # Comprobamos si esa zona es valida
+ except :
+ import skins
+ pagina = skins.Skin(path,usuario)
+ pagina.load_dict({"page_title": "cpif - Cambio de configuración erroneo"})
+ pagina.load_url(["error"])
+ pagina.load_dict({"generic_message": "<h1>La zona horaria especificada es inválida</h1>"})
+ return pagina.web()
+
+ database.usuario_update(conn,"",TZ=tz)
+
conf.update(new_conf) # Be careful, since the dictionary is persistent
# We do a commit here to be sure we store the
More information about the cpif
mailing list