Opened 11 years ago

Closed 11 years ago

#2136 closed defect (fixed)

ValueError: day is out of range for month

Reported by: edward.chwieseni@… Owned by: Bhuricha Deen Sethanandha
Priority: highest Component: TracMetrixPlugin
Severity: blocker Keywords:
Cc: Trac Release: 0.11

Description (last modified by Bhuricha Deen Sethanandha)

I logged in to trac and selected "Dashboard" and received the following error:

Trac detected an internal error: 
    ValueError: day is out of range for month

Most recent call last: 
File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r6047-py2.4.egg/trac/web/", line 381, in dispatch_request 
Code fragment:
        if not env and env_error:            raise HTTPInternalError(env_error)        try:            try:                dispatcher = RequestDispatcher(env)
                                      except RequestDone:                pass            return req._response or []        finally:            if not run_once:
                        Local variables:
Name Value 
after ['            except RequestDone:', '                pass', '             ... 
before ['        if not env and env_error:', '            raise  ... 
dispatcher <trac.web.main.RequestDispatcher object at 0x8b1894c> 
e <exceptions.ValueError instance at 0x92d8bec> 
env <trac.env.Environment object at 0x8a5aa0c> 
env_error None 
env_name 'gmstudy' 
env_parent_dir '/opt/tracHome' 
env_path '/opt/tracHome/gmstudy' 
env_paths None 
environ {'wsgi.multiprocess': True, 'HTTP_COOKIE':  ... 
exc_info (<class exceptions.ValueError at 0xb7f8fb0c>, <exceptions.ValueError  ... 
filename '/usr/lib/python2.4/site-packages/Trac-0.11dev_r6047-py2.4.egg/trac/web/mai ... 
frames [{'function': 'dispatch_request', 'lines_before': ['        if not env and  ... 
has_admin True 
line '                dispatcher.dispatch(req)' 
lineno 380 
message u'ValueError: day is out of range for month' 
path_info ['pdashboard'] 
req <Request "GET u'/pdashboard'"> 
run_once False 
script_url None 
start_response <bound method ModPythonGateway._start_response of  ... 
tb <traceback object at 0x93dfcac> 
tb_hide None 
traceback 'Traceback (most recent call last):\n  File  ... 

File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r6047-py2.4.egg/trac/web/", line 191, in dispatch 
Code fragment:
                                     'Do you have cookies enabled?')         # Process the request and render the template        try:            try:
                                          resp = chosen_handler.process_request(req)
                                          if resp:                    if len(resp) == 2: # Clearsilver                        chrome.populate_hdf(req)                        template, content_type = \                                  self._post_process_request(req, *resp)
                        Local variables:
Name Value 
chosen_handler <tracmetrixplugin.web_ui.PDashboard object at 0x8ad2eac> 
chrome < object at 0x8b1776c> 
err (<class exceptions.ValueError at 0xb7f8fb0c>, <exceptions.ValueError  ... 
handler <tracmetrixplugin.web_ui.PDashboard object at 0x8ad2eac> 
req <Request "GET u'/pdashboard'"> 
self <trac.web.main.RequestDispatcher object at 0x8b1894c> 

File "build/bdist.linux-i686/egg/tracmetrixplugin/", line 119, in process_request 
Local variables:
Name Value 
db <trac.db.pool.PooledConnection object at 0x92cfc0c> 
filename None 
req <Request "GET u'/pdashboard'"> 
self <tracmetrixplugin.web_ui.PDashboard object at 0x8ad2eac> 

File "build/bdist.linux-i686/egg/tracmetrixplugin/", line 190, in _render_view 
Local variables:
Name Value 
bmi_stats [('10/2007', [2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L,  ... 
closed_stat <trac.ticket.roadmap.TicketGroupStats object at 0x934d28c> 
data {'proj_closed_stat': {'stats_href': '/trac/gmstudy/query/%7B%7D',  ... 
db <trac.db.pool.PooledConnection object at 0x92cfc0c> 
first_day datetime.datetime(2007, 9, 1, 0, 0, tzinfo=<FixedOffset "UTC" 0:00:00>) 
interval {'count': 2L, 'title': u'duplicate', 'css_class': 'waste', 'countsToProg':  ... 
last_day datetime.datetime(2007, 10, 31, 0, 0, tzinfo=<FixedOffset "UTC" 0:00:00>) 
milestone <trac.ticket.model.Milestone object at 0x92dfa8c> 
milestones [<trac.ticket.model.Milestone object at 0x92df24c>,  ... 
proj_stat <trac.ticket.roadmap.TicketGroupStats object at 0x934dccc> 
project {'name': u'GM Study', 'description': u'Glioma/Meningioma Brain Cancer  ... 
project_tickets [2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L,  ... 
queries [] 
req <Request "GET u'/pdashboard'"> 
self <tracmetrixplugin.web_ui.PDashboard object at 0x8ad2eac> 
showall False 
stat <trac.ticket.roadmap.TicketGroupStats object at 0x934a4ec> 
stats [{'stats_href': '/trac/gmstudy/query?group=status&milestone=Iteration+3',  ... 
tickets [{'status': u'QA', 'owner': u'annepuvr', 'id': 101L}, {'status': u'QA',  ... 
tkt_duration_stats {'Lead time': <tracmetrixplugin.model.DescriptiveStats object at  ... 
tkt_frequency_stats {'Number of milestone changed per ticket':  ... 
tkt_group_metrics <tracmetrixplugin.model.TicketGroupMetrics object at 0x934d0cc> 
tkt_stats {} 
today datetime.datetime(2007, 10, 31, 8, 56, 29, 803979) 

Attachments (0)

Change History (5)

comment:1 Changed 11 years ago by anonymous


System Information: User Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.1; .NET CLR 2.0.50727)

Trac: 0.11dev-r6047 Python: 2.4.3 (#1, Mar 14 2007, 18:51:08) [GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] setuptools: 0.6c7 MySQL: server: "5.0.22", client: "5.0.22", thread-safe: 1 MySQLdb: 1.2.2 Genshi: 0.4.4 Mercurial: 0.9.4 jQuery:

comment:2 Changed 11 years ago by edward.chwieseni@…

Starting at line 190 shouldn't first_day be validated to ensure that it falls within the month?

# get daily stat from today and a month back first_day = last_day_of_month(today.year, today.month-1) last_day = datetime(today.year, today.month,, tzinfo=utc)

comment:3 Changed 11 years ago by Noah Kantrowitz

Description: modified (diff)

Holy formatting, Batman!

comment:4 Changed 11 years ago by Bhuricha Deen Sethanandha

Description: modified (diff)
Status: newassigned

comment:5 Changed 11 years ago by Bhuricha Deen Sethanandha

Resolution: fixed
Status: assignedclosed

Nice catch. Thanks for pointing that out. Right now I change the number of days to 28 days in the past (4 weeks) instead of using same day of the previous month. This value could be parameter in the trac.ini file in the future.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Bhuricha Deen Sethanandha.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.