[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Translation of http status code to text
From: |
Ted Zlatanov |
Subject: |
Re: Translation of http status code to text |
Date: |
Tue, 23 Mar 2010 10:02:24 -0500 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) |
On Tue, 23 Mar 2010 11:54:18 +0200 Juri Linkov <address@hidden> wrote:
JL> Please don't add symbols. Developers prefer to refer to numbers.
I considered that but it really seemed useful to have symbolic codes as
I was working through the list of text explanations.
On Tue, 23 Mar 2010 11:54:40 +0100 address@hidden wrote:
j> As a developer I'd like both numbers and symbols. Maybe thats just me. I
j> think this is a bit particular for the http protocol, since some codes
j> are extremely well known, whereas others are not.
Ditto.
On Tue, 23 Mar 2010 08:57:15 -0400 Stefan Monnier <address@hidden> wrote:
SM> I see, then it's OK to add symbols, I guess, but in this case use
SM> shorter ones, so you can do:
SM> (case (cadr (assq status-number url-http-codes)))
SM> (OK ...)
SM> (moved-permanently ...)
SM> (proxy-authentication-required ...)
SM> (accepted ...)
SM> ...)
Yeah, that was the other option. It works too.
SM> And in that case, a better option is to create the symbols
SM> programmatically from the error string:
SM> (defconst url-http-codes
SM> (mapcar (lambda (x)
SM> (let ((s (subst-char-in-string ?\s ?- (cadr x))))
SM> (when (string-match "-(.*)" s)
SM> (setq s (substring s 0 (match-beginning 0))))
SM> (list (car x) (intern (downcase s)) (cadr x))))
SM> '((100 "Continue with request")
SM> ...)))
>From the perspective of the programmer it's better to see the symbols
(grep won't work with this approach). Also "OK" look weird as the "ok"
status code and "time-out" in the error code is odd IMHO. These are
matters of taste but I hope you'll allow that the manually generated
table is a little better. It only has to be done once, after all.
Attached is another attempt which uses the symbols in the code and
doesn't dynamically generate the symbols.
Ted
url-http-codes.patch
Description: Text Data
- Re: highlighting non-ASCII characters, (continued)
- Re: highlighting non-ASCII characters, Juri Linkov, 2010/03/25
- RE: highlighting non-ASCII characters, Drew Adams, 2010/03/23
- Re: highlighting non-ASCII characters, Stephen J. Turnbull, 2010/03/24
- Re: highlighting non-ASCII characters, Juri Linkov, 2010/03/24
- Re: highlighting non-ASCII characters, Ted Zlatanov, 2010/03/24
- Re: highlighting non-ASCII characters, Juri Linkov, 2010/03/24
- Re: Translation of http status code to text, Stefan Monnier, 2010/03/22
- Re: Translation of http status code to text, Ted Zlatanov, 2010/03/22
- Re: Translation of http status code to text, Juri Linkov, 2010/03/23
- Re: Translation of http status code to text, joakim, 2010/03/23
- Re: Translation of http status code to text,
Ted Zlatanov <=
- Re: Translation of http status code to text, Stefan Monnier, 2010/03/23
- Re: Translation of http status code to text, Glenn Morris, 2010/03/24
- Re: Translation of http status code to text, Ted Zlatanov, 2010/03/24
- Re: Translation of http status code to text, Ted Zlatanov, 2010/03/24
- Re: Translation of http status code to text, Stefan Monnier, 2010/03/23