Edgewall Software

Opened 17 years ago

Last modified 17 years ago

#4497 closed defect

AttributeError: 'long' object has no attribute 'astimezone' — at Initial Version

Reported by: sean.kane@… 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

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.

Before you do that, though, please first try searching for similar issues, as it is quite likely that this problem has been reported before. For questions about installation and configuration of Trac, please try the mailing list instead of filing a ticket.

Otherwise, please ==== 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' a new ticket at the Trac project site, where you can describe the problem and explain how to reproduce it.

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 Most recent call last:

  • File "/usr/local/lib/python2.5/site-packages/trac/web/main.py", line 395, in dispatch_request Code fragment:
    1. req = Request(environ, start_response)
    2. try:
    3. try:
    4. try:
    5. dispatcher = RequestDispatcher(env)
    6. dispatcher.dispatch(req)
    7. except RequestDone:
    8. pass
    9. return req._response or []
    10. finally:
    11. 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:
    1. 'Do you have cookies enabled?')
    2. # Process the request and render the template
    3. try:
    4. try:
    5. resp = chosen_handler.process_request(req)
    6. if resp:
    7. if len(resp) == 2: # Clearsilver
    8. chrome.populate_hdf(req)
    9. template, content_type = \
    10. 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:
    1. provider = providers.get((cat_id, panel_id), None)
    2. if not provider:
    3. raise HTTPNotFound('Unknown administration panel')
    4. template, data = provider.render_admin_panel(req, cat_id, panel_id,
    5. path_info)
    6. data.update({
    7. 'active_cat': cat_id, 'active_panel': panel_id,
    8. 'panel_href': partial(req.href, 'admin', cat_id, panel_id),
    9. 'panels': [{
    10. '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:
    1. tzinfo = localtz
    2. if t is None:
    3. t = datetime.now(utc)
    4. if isinstance(t, int):
    5. t = datetime.fromtimestamp(t, tzinfo)
    6. t = t.astimezone(tzinfo)
    7. text = t.strftime(format)
    8. encoding = locale.getpreferredencoding()
    9. if sys.platform != 'win32':
    10. encoding = locale.getlocale(locale.LC_TIME)[1] or encoding
    11. # 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)

TracGuide — The Trac User and Administration Guide

Change History (0)

Note: See TracTickets for help on using tickets.