[27537] in Source-Commits
python-discuss commit: More permissive hostname regexp
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Mon Dec 9 14:22:13 2013
Date: Mon, 9 Dec 2013 14:22:05 -0500
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201312091922.rB9JM5YZ013884@drugstore.mit.edu>
To: source-commits@MIT.EDU
https://github.com/mit-athena/python-discuss/commit/09bc8cb1967f6a4e5298a9b8d06d29a04c464fb9
commit 09bc8cb1967f6a4e5298a9b8d06d29a04c464fb9
Author: Jonathan Reed <jdreed@mit.edu>
Date: Thu Nov 21 11:26:17 2013 -0500
More permissive hostname regexp
The server field should be allowed to contain uppercase letters
and numbers. We should convert it to lowercase when storing the
entry, for consistency with the rest of the implementation.
discuss/rcfile.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/discuss/rcfile.py b/discuss/rcfile.py
index 2541f8f..978dd7a 100644
--- a/discuss/rcfile.py
+++ b/discuss/rcfile.py
@@ -60,7 +60,7 @@ class RCFile:
rcfile = open(self.location, "r")
entries = {}
for line in rcfile:
- match = re.match(r"^(\d):(\d+):(\d+):([a-z.\-]+):([^:]+):([^:]+):$", line.strip())
+ match = re.match(r"^(\d):(\d+):(\d+):([a-zA-Z\d.\-]+):([^:]+):([^:]+):$", line.strip())
if not match:
raise ValueError("Malformed .meetings file entry")
status = int(match.group(1))
@@ -69,7 +69,7 @@ class RCFile:
'deleted' : bool(status & 0x02),
'last_timestamp' : int(match.group(2)),
'last_transaction' : int(match.group(3)),
- 'hostname' : match.group(4),
+ 'hostname' : match.group(4).lower(),
'path' : match.group(5),
'names' : match.group(6).split(','),
}