Device management crashes on new NAV installation

Bug #258265 reported by Morten Brekkevold
2
Affects Status Importance Assigned to Milestone
Network Administration Visualized
Fix Released
Medium
Stein Magnus Jodal

Bug Description

Found this while testing the upcoming 3.3.0 release candidate. Probably,
device management is trying to retrieve the first alerthist entry to
determine which years to populate a dropdown box with. But, being a fresh
installation, there are no alerthist entries.

Traceback:

Mod_python error: "PythonHandler nav.web.devicemanagement.handler"

Traceback (most recent call last):

  File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 299,
in HandlerDispatch
    result = object(req)

  File "/usr/local/nav/lib/python/nav/web/devicemanagement/handler.py",
line 70, in handler
    output = history(req)

  File "/usr/local/nav/lib/python/nav/web/devicemanagement/history.py",
line 71, in history
    date_options['startyear'] = db.dictfetchall()[0]['min'].year

AttributeError: 'NoneType' object has no attribute 'year'

[http://sourceforge.net/tracker/index.php?func=detail&aid=1797010&group_id=107608&atid=648170]

Revision history for this message
Stein Magnus Jodal (jodal) wrote :

Originator: NO

Fixed in r4227:

Device Management:
* Aggregate functions like min() always returns a row, so one must check
if the
  value is NULL instead of checking for >0 rows. Somehow, the NULL value
in
  PostgreSQL translates to something not-None in Python, which has no
type,
  string representation but is True. This was solved by letting PSQL
decide if
  the returned value was true or not. (Closes: SF#1797010)

Changed in nav:
milestone: trunk → v3.3
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.