[bugzilla-gnome-org-extensions] Cut and paste BaseHttpRequestHandler.date_time_string
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bugzilla-gnome-org-extensions] Cut and paste BaseHttpRequestHandler.date_time_string
- Date: Thu, 20 Nov 2014 22:19:03 +0000 (UTC)
commit a5f24ae566c89b6199272568a223ee32e914b8ec
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Mon Sep 14 14:37:51 2009 -0400
Cut and paste BaseHttpRequestHandler.date_time_string
Python 2.4 didn't support an optional timestamp argument to
get_date_time_string() - cut and paste the Python 2.6 version
of the function into our code to work-around that.
proxy/splinter_proxy.py | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/proxy/splinter_proxy.py b/proxy/splinter_proxy.py
index cd6f0a3..5d3e7ce 100755
--- a/proxy/splinter_proxy.py
+++ b/proxy/splinter_proxy.py
@@ -176,6 +176,19 @@ class ProxyHandler(SimpleHTTPRequestHandler):
connection.close()
+ # Copy of date_time_string() in the Python-2.6 BaseHttpRequestHandler
+ # Differs from the the Python-2.4 version in taking an optional time to format.
+ def date_time_string(self, timestamp=None):
+ """Return the current date and time formatted for a message header."""
+ if timestamp is None:
+ timestamp = time.time()
+ year, month, day, hh, mm, ss, wd, y, z = time.gmtime(timestamp)
+ s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (
+ self.weekdayname[wd],
+ day, self.monthname[month], year,
+ hh, mm, ss)
+ return s
+
def do_config_js(self):
self.send_response(200, "OK")
self.send_header("Content-type", "text/javascript")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]