Repository: dmwm/wmcore
Issue: [py2py3] Internal Server Error when browing through the ReqMgr2 GUI by status

**Impact of the bug**
ReqMgr2 GUI

**Describe the bug**
This bug has been introduced with the migration to Python3, thus in the tag `1.5.0`. Here is the service traceback [1]

**How to reproduce it**
Go to the Home page of ReqMgr2: https://alancc7-cloud2.cern.ch/reqmgr2/home
and select one of those statuses. It should return a `500 Internal Server Error`.

**Expected behavior**
The http request should be properly served and requests under that given status properly returned in the GUI.

**Additional context and error message**
Already discussed this with Dima and Hasan, and from their side this is not critical. So marking it as medium priority. Still, I think we should have a patch release for this, raising Internal Server Error in production for one month is just BAD!!!

Perhaps related to: https://github.com/dmwm/WMCore/issues/10382 ?

[1]
```
[03/Jul/2021:12:02:28] HTTP 
Traceback (most recent call last):
  File "/data/srv/HG2106g-comp2/sw.amaltaro/slc7_amd64_gcc630/external/py3-cherrypy/17.4.0/lib/python3.8/site-packages/cherrypy/_cprequest.py", line 630, in respond
    self._do_respond(path_info)
  File "/data/srv/HG2106g-comp2/sw.amaltaro/slc7_amd64_gcc630/external/py3-cherrypy/17.4.0/lib/python3.8/site-packages/cherrypy/_cprequest.py", line 689, in _do_respond
    response.body = self.handler()
  File "/data/srv/HG2106g-comp2/sw.amaltaro/slc7_amd64_gcc630/external/py3-cherrypy/17.4.0/lib/python3.8/site-packages/cherrypy/lib/encoding.py", line 221, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/data/srv/HG2106g-comp2/sw.amaltaro/slc7_amd64_gcc630/external/py3-cherrypy/17.4.0/lib/python3.8/site-packages/cherrypy/_cpdispatch.py", line 54, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/data/srv/HG2106g-comp2/sw.amaltaro/slc7_amd64_gcc630/cms/reqmgr2/1.5.0.pre5/lib/python3.8/site-packages/WMCore/ReqMgr/Web/ReqMgrService.py", line 644, in requests
    docs.append(request_attr(doc, attrs))
  File "/data/srv/HG2106g-comp2/sw.amaltaro/slc7_amd64_gcc630/cms/reqmgr2/1.5.0.pre5/lib/python3.8/site-packages/WMCore/ReqMgr/Web/ReqMgrService.py", line 123, in request_attr
    gmt = time.gmtime(time.mktime(tval))
TypeError: Tuple or struct_time argument required
[03/Jul/2021:12:02:28] HTTP 
....
[03/Jul/2021:12:02:28] alancc7-cloud2.cern.ch 188.185.123.65 "GET /reqmgr2/requests?status=assigned HTTP/1.1" 500 Internal Server Error [data: 4522 in 824 out 88102 us ] ....
```

Changed files:
src/python/WMCore/ReqMgr/Web/ReqMgrService.py

diff --git a/src/python/WMCore/ReqMgr/Web/ReqMgrService.py b/src/python/WMCore/ReqMgr/Web/ReqMgrService.py
index 998079803..38ab150a0 100644
--- a/src/python/WMCore/ReqMgr/Web/ReqMgrService.py
+++ b/src/python/WMCore/ReqMgr/Web/ReqMgrService.py
@@ -120,7 +120,9 @@ def request_attr(doc, attrs=None):
                 if isinstance(tval, list):
                     while len(tval) < 9:
                         tval.append(0)
-                    gmt = time.gmtime(time.mktime(tval))
+                    # we do not know if dayling savings time was in effect or not
+                    tval[-1] = -1
+                    gmt = time.gmtime(time.mktime(tuple(tval)))
                     rdict[key] = time.strftime("%Y-%m-%d %H:%M:%S GMT", gmt)
                 else:
                     rdict[key] = tval