#4497 closed defect (wontfix)
AttributeError: 'long' object has no attribute 'astimezone'
| Reported by: | Owned by: | Christopher Lenz | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | admin/web | Version: | devel |
| Severity: | blocker | Keywords: | long astimezone Account Manager users |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description (last modified by )
How to Reproduce
While doing a GET operation on /admin/accounts/users, Trac issued an internal error.
System Information
| Trac | 0.11dev
|
| Python | 2.5 (r25:51908, Jan 3 2007, 23:53:09) [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-56)] |
| MySQL | 5.0.27-standard
|
| MySQLdb | 1.2.1_p2
|
| Genshi | 0.3.6
|
| Pygments | 0.6
|
| Subversion | 1.4.2
|
Python Traceback
Traceback (most recent call last):
File "/usr/local/lib/python2.5/site-packages/trac/web/main.py", line 395, in dispatch_request
dispatcher.dispatch(req)
File "/usr/local/lib/python2.5/site-packages/trac/web/main.py", line 213, in dispatch
resp = chosen_handler.process_request(req)
File "/usr/local/lib/python2.5/site-packages/trac/admin/web_ui.py", line 84, in process_request
path_info)
File "build/bdist.linux-i686/egg/acct_mgr/admin.py", line 47, in render_admin_panel
return self._do_users(req)
File "build/bdist.linux-i686/egg/acct_mgr/admin.py", line 129, in _do_users
account['last_visit'] = format_datetime(last_visit)
File "/usr/local/lib/python2.5/site-packages/trac/util/datefmt.py", line 60, in format_datetime
t = t.astimezone(tzinfo)
AttributeError: 'long' object has no attribute 'astimezone'
Cut and Paste from the web page:
Trac detected an internal error:
AttributeError: 'long' object has no attribute 'astimezone'
If you think this should work you can reproduce the problem, you should consider reporting this to the Trac team.
* File "/usr/local/lib/python2.5/site-packages/trac/web/main.py", line 395, in dispatch_request
Code fragment:
389. req = Request(environ, start_response)
390. try:
391. try:
392. try:
393. dispatcher = RequestDispatcher(env)
394. dispatcher.dispatch(req)
395. except RequestDone:
396. pass
397. return req._response or []
398. finally:
399. if not run_once:
Local variables:
Name Value
after [' except RequestDone:', ' pass', ' ...
before [' req = Request(environ, start_response)', ' try:', ' try:', ...
dispatcher <trac.web.main.RequestDispatcher object at 0xb6d179ac>
e AttributeError("'long' object has no attribute 'astimezone'",)
egg_cache '/usr/local/share/trac/egg_cache'
env <trac.env.Environment object at 0xb700d60c>
env_name 'VMS'
env_parent_dir '/usr/local/share/trac/projects'
env_path '/usr/local/share/trac/projects/VMS'
env_paths None
environ {'HTTP_AUTHORIZATION': 'Basic a2FuZXM6d2FzNDJhYmk=', 'wsgi.multiprocess': ...
exc_info (<type 'exceptions.AttributeError'>, AttributeError("'long' object has no ...
filename '/usr/local/lib/python2.5/site-packages/trac/web/main.py'
frames [{'function': 'dispatch_request', 'lines_before': [' req = ...
line ' dispatcher.dispatch(req)'
lineno 394
message u"AttributeError: 'long' object has no attribute 'astimezone'"
options {'TracUriRoot': '/projects', 'TracEnvParentDir': ...
path_info ['admin', 'accounts', 'users']
req <Request "GET /admin/accounts/users">
request_uri '/projects/VMS/admin/accounts/users'
root_uri '/projects'
run_once False
start_response <bound method ModPythonGateway._start_response of ...
tb <traceback object at 0xb6c4ac0c>
traceback 'Traceback (most recent call last):\n File ...
* File "/usr/local/lib/python2.5/site-packages/trac/web/main.py", line 213, in dispatch
Code fragment:
207. 'Do you have cookies enabled?')
208.
209. # Process the request and render the template
210. try:
211. try:
212. resp = chosen_handler.process_request(req)
213. if resp:
214. if len(resp) == 2: # Clearsilver
215. chrome.populate_hdf(req)
216. template, content_type = \
217. self._post_process_request(req, *resp)
Local variables:
Name Value
chosen_handler <trac.admin.web_ui.AdminModule object at 0xb6d17b0c>
chrome <trac.web.chrome.Chrome object at 0xb6cf446c>
err (<type 'exceptions.AttributeError'>, AttributeError("'long' object has no ...
handler <trac.admin.web_ui.AdminModule object at 0xb6d17b0c>
req <Request "GET /admin/accounts/users">
self <trac.web.main.RequestDispatcher object at 0xb6d179ac>
* File "/usr/local/lib/python2.5/site-packages/trac/admin/web_ui.py", line 84, in process_request
Code fragment:
78. provider = providers.get((cat_id, panel_id), None)
79. if not provider:
80. raise HTTPNotFound('Unknown administration panel')
81.
82. template, data = provider.render_admin_panel(req, cat_id, panel_id,
83. path_info)
84. data.update({
85. 'active_cat': cat_id, 'active_panel': panel_id,
86. 'panel_href': partial(req.href, 'admin', cat_id, panel_id),
87. 'panels': [{
88. 'category': {'id': panel[0], 'label': panel[1]},
Local variables:
Name Value
cat_id u'accounts'
panel_id u'users'
panels [('accounts', 'Accounts', 'config', 'Configuration'), ('accounts', ...
path_info None
provider <acct_mgr.admin.AccountManagerAdminPage object at 0xb6cda70c>
providers {('general', 'basics'): <trac.admin.web_ui.BasicsAdminPanel object at ...
req <Request "GET /admin/accounts/users">
self <trac.admin.web_ui.AdminModule object at 0xb6d17b0c>
* File "build/bdist.linux-i686/egg/acct_mgr/admin.py", line 47, in render_admin_panel
Local variables:
Name Value
cat u'accounts'
page u'users'
path_info None
req <Request "GET /admin/accounts/users">
self <acct_mgr.admin.AccountManagerAdminPage object at 0xb6cda70c>
* File "build/bdist.linux-i686/egg/acct_mgr/admin.py", line 129, in _do_users
Local variables:
Name Value
account { XXXX DELETED FOR SECURITY XXXX
accounts { XXXX DELETED FOR SECURITY XXXX
create_enabled True
cursor <trac.db.util.IterableCursor object at 0xb6ca4cd4>
data {'create_enabled': True, 'delete_enabled': True, 'listing_enabled': True}
db <trac.db.pool.PooledConnection object at 0xb6c3462c>
delete_enabled True
email XXXX DELETED FOR SECURITY XXXX
last_visit 1167955396L
listing_enabled True
name XXXX DELETED FOR SECURITY XXXX
perm <trac.perm.PermissionSystem object at 0xb6ce630c>
req <Request "GET /admin/accounts/users">
self <acct_mgr.admin.AccountManagerAdminPage object at 0xb6cda70c>
username XXXX DELETED FOR SECURITY XXXX
* File "/usr/local/lib/python2.5/site-packages/trac/util/datefmt.py", line 60, in format_datetime
Code fragment:
54. tzinfo = localtz
55. if t is None:
56. t = datetime.now(utc)
57. if isinstance(t, int):
58. t = datetime.fromtimestamp(t, tzinfo)
59. t = t.astimezone(tzinfo)
60. text = t.strftime(format)
61. encoding = locale.getpreferredencoding()
62. if sys.platform != 'win32':
63. encoding = locale.getlocale(locale.LC_TIME)[1] or encoding
64. # the above is broken on win32, e.g. we'd get '437' instead of 'cp437'
Local variables:
Name Value
format '%x %X'
t 1167955396L
tzinfo <trac.util.datefmt.LocalTimezone object at 0xb70f958c>
File "/usr/local/lib/python2.5/site-packages/trac/web/main.py", line 394, in dispatch_request
dispatcher.dispatch(req)
File "/usr/local/lib/python2.5/site-packages/trac/web/main.py", line 212, in dispatch
resp = chosen_handler.process_request(req)
File "/usr/local/lib/python2.5/site-packages/trac/admin/web_ui.py", line 83, in process_request
path_info)
File "build/bdist.linux-i686/egg/acct_mgr/admin.py", line 46, in render_admin_panelFile "build/bdist.linux-i686/egg/acct_mgr/admin.py", line 128, in _do_usersFile "/usr/local/lib/python2.5/site-packages/trac/util/datefmt.py", line 59, in format_datetime
t = t.astimezone(tzinfo)
Attachments (0)
Change History (5)
comment:1 by , 19 years ago
comment:2 by , 19 years ago
| Description: | modified (diff) |
|---|---|
| Resolution: | → wontfix |
| Status: | new → closed |
This is a TracHacks:AccountManagerPlugin issue, please report it on TracHacks
(there, you can refer to this ticket for the actual traceback if you want, using the Trac:ticket:4497 InterTrac link).
comment:3 by , 19 years ago
Please see the latest comment at http://trac-hacks.org/ticket/1149 for the fix. It seems to me that it might be best implemented in trac, having format_datetime check for a long in addition to the int that it checks for when converting to a datetime.
comment:4 by , 19 years ago
Good suggestion, I'll do that after I merge other format_datetime changes.



I get the same error for 0.11dev on Windows 2003 server with Python 2.4.2.