[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-06-16 Thread anatoly techtonik
anatoly techtonik added the comment: I do not like the idea that BaseHTTPServer depends on email package, which in turn may depend on another package etc. Having date formatting function inside of email package breaks "single responsibility" principle that would be nice to have in stdlib. --

[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-06-13 Thread Éric Araujo
Éric Araujo added the comment: The skeleton is good but you have to change one thing. Your test should exercise a function or method of BaseHTTPServer, not the underlying implementation detail. I failed to explain that earlier: 1a) Write a test that checks that the current code produces right v

[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-06-13 Thread Shashwat Anand
Shashwat Anand added the comment: Agreed. Attaching the unit test. -- Added file: http://bugs.python.org/file17656/test_httpserver.patch ___ Python tracker ___ __

[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-06-06 Thread Éric Araujo
Éric Araujo added the comment: Opinions are nice, tests are better! :) -- ___ Python tracker ___ ___ Python-bugs-list mailing list Uns

[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-06-06 Thread Shashwat Anand
Shashwat Anand added the comment: > You could get a minor speedup by doing “from email.utils import formatdate”. I guess I shall do that. Applied the patch and tested it, it does not break anything IMO and should go in python2.7 -- Added file: http://bugs.python.org/file17573/BaseHTT

[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-06-06 Thread Shashwat Anand
Changes by Shashwat Anand : Removed file: http://bugs.python.org/file17567/BaseHTTPServer.patch ___ Python tracker ___ ___ Python-bugs-list mai

[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-06-06 Thread Éric Araujo
Éric Araujo added the comment: You could get a minor speedup by doing “from email.utils import formatdate”. Do we have tests know to check that the patch does not break anything? Can this still go into 2.7? -- ___ Python tracker

[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-06-05 Thread Shashwat Anand
Shashwat Anand added the comment: Seems that earlier patch was incorrect. Rectifying and submitting the correct patch. -- Added file: http://bugs.python.org/file17567/BaseHTTPServer.patch ___ Python tracker __

[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-06-05 Thread Shashwat Anand
Changes by Shashwat Anand : Removed file: http://bugs.python.org/file16900/BaseHTTPServer.patch ___ Python tracker ___ ___ Python-bugs-list mai

[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-04-12 Thread Shashwat Anand
Changes by Shashwat Anand : Added file: http://bugs.python.org/file16900/BaseHTTPServer.patch ___ Python tracker ___ ___ Python-bugs-list maili

[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-04-12 Thread Shashwat Anand
Shashwat Anand added the comment: Quoting from the docstring of trunk/Lib/email/utils.py -> formatdate() "We cannot use strftime() because that honors the locale and RFC 2822 requires that day and month names be the English abbreviations." So yes, I do agree that email.utils.formatdate() shou

[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-04-12 Thread Shashwat Anand
Changes by Shashwat Anand : Removed file: http://bugs.python.org/file16890/BaseHTTPServer.patch ___ Python tracker ___ ___ Python-bugs-list mai

[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-04-12 Thread Éric Araujo
Éric Araujo added the comment: “One could also ask whether BaseHTTPServer should use the logging module, but that is a whole separate issue.” Indeed: http://www.python.org/dev/peps/pep-0337/ Cheers -- ___ Python tracker

[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-04-12 Thread R. David Murray
R. David Murray added the comment: There are a couple problems with this patch. The first is that fixing date_time_string by using strftime rather than email.utils.formatdate is suboptimal from a code reuse standpoint. The reason is that the date in HTTP message headers is required to confo

[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-04-12 Thread Éric Araujo
Éric Araujo added the comment: Nice catch. The patch looks good to me and applies correctly on my trunk copy. There seems to be no test about this in the test suite; do you have a little test script to compare old and new code? On a sidenote, I find all this business with time.time, time.gmti

[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-04-11 Thread Shashwat Anand
Shashwat Anand added the comment: Instead of “email.utils.formatdate(time, usegmt=True)” we can simply use time.strftime() and clean the code in a better way. The duplication is there in date_time_string() as well as log_date_time_string(). Submitting the patch for review. -- nosy: +

[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-04-08 Thread R. David Murray
Changes by R. David Murray : -- title: patch: BaseHTTPServer reinventing rfc822 -> patch: BaseHTTPServer reinventing rfc822 date formatting ___ Python tracker ___ ___

[issue7370] patch: BaseHTTPServer reinventing rfc822

2010-04-08 Thread R. David Murray
Changes by R. David Murray : -- versions: +Python 3.2 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mai

[issue7370] patch: BaseHTTPServer reinventing rfc822

2010-04-08 Thread R. David Murray
R. David Murray added the comment: The issue is not invalid. The code duplication should be removed, but using the email module as Éric suggests. Reopening. -- nosy: +r.david.murray resolution: invalid -> stage: committed/rejected -> test needed status: closed -> open __

[issue7370] patch: BaseHTTPServer reinventing rfc822

2010-04-08 Thread Éric Araujo
Éric Araujo added the comment: Following the last link on #2859, I’ve found that “rfc822.formatdate(time)” can be changed to “email.utils.formatdate(time, usegmt=True)”. I’ll make a real diff in a few days if noone beats me to it. Regards -- nosy: +merwok ___

[issue7370] patch: BaseHTTPServer reinventing rfc822

2010-04-08 Thread Daniel Diniz
Daniel Diniz added the comment: Thanks for the patch. Per issue 2849, use of rfc822 should be gone from the stdlib. Please re-open if you disagree. -- nosy: +ajaksu2 priority: -> normal resolution: -> invalid stage: -> committed/rejected status: open -> closed _

[issue7370] patch: BaseHTTPServer reinventing rfc822

2009-11-20 Thread Josh Kupershmidt
New submission from Josh Kupershmidt : While digging through Lib/BaseHTTPServer.py, I noticed that the date_time_string() function duplicates rfc822.formatdate(). Attached is a patch to eliminate this duplication of code. -- components: Library (Lib) files: BaseHTTPServer.patch keywords: