Undo this change, bad idea.

English letters do not always sort as expected in non-en locales.
This commit is contained in:
Nick Daly 2013-10-27 17:41:19 -05:00
parent dc9331353f
commit 9e276c3ffb

View File

@ -40,7 +40,7 @@ def valid_hostname(name):
if not is_alphanumeric(name): if not is_alphanumeric(name):
message += "<br />Hostname must be alphanumeric" message += "<br />Hostname must be alphanumeric"
if not bool(re.match("A-z", name[0])): if not name[0] in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ":
message += "<br />Hostname must start with a letter" message += "<br />Hostname must start with a letter"
return message return message
@ -53,12 +53,11 @@ def set_hostname(hostname):
cfg.log.info("Changing hostname to '%s'" % hostname) cfg.log.info("Changing hostname to '%s'" % hostname)
try: try:
privilegedaction_run("hostname-change", [hostname]) privilegedaction_run("hostname-change", [hostname])
except OSError, e:
raise cherrypy.HTTPError(500, "Updating hostname failed: %s" % e)
else:
# don't persist/cache change unless it was saved successfuly # don't persist/cache change unless it was saved successfuly
sys_store = filedict_con(cfg.store_file, 'sys') sys_store = filedict_con(cfg.store_file, 'sys')
sys_store['hostname'] = hostname sys_store['hostname'] = hostname
except OSError, e:
raise cherrypy.HTTPError(500, "Updating hostname failed: %s" % e)
class general(FormPlugin, PagePlugin): class general(FormPlugin, PagePlugin):
url = ["/sys/config"] url = ["/sys/config"]
@ -142,3 +141,4 @@ class general(FormPlugin, PagePlugin):
privilegedaction_run("timezone-change", [time_zone]) privilegedaction_run("timezone-change", [time_zone])
sys_store['time_zone'] = time_zone sys_store['time_zone'] = time_zone
return message or "Settings updated." return message or "Settings updated."