Bug 808780

Summary: "TypeError: object of type 'NoneType' has no len()" when using TreeModel[iter]
Product: [Fedora] Fedora Reporter: Vratislav Podzimek <vpodzime>
Component: pygobject3Assignee: John (J5) Palmieri <johnp>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: icq, jkeck, johnp
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-13 10:10:04 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Vratislav Podzimek 2012-03-31 16:14:21 EDT
Description of problem:
In this piece of code:

  cities_model = self._cityCombo.get_model()
  cities_iter = self._cityCombo.get_active_iter()
  city = cities_model[cities_iter][0]

I get the following traceback:
Traceback (most recent call last):
  File FILE_PATH_OMITTED, line 204, in on_city_changed
    city = cities_model[cities_iter][0]
  File "/usr/lib/python2.7/site-packages/gi/overrides/Gtk.py", line 730, in __getitem__
    aiter = self.get_iter(key)
  File "/usr/lib/python2.7/site-packages/gi/overrides/Gtk.py", line 744, in get_iter
    path = TreePath(path)
  File "/usr/lib/python2.7/site-packages/gi/overrides/Gtk.py", line 1121, in __new__
    if len(path) == 0:
TypeError: object of type 'NoneType' has no len()

Problem here is that cities_iter is None

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. try to use TreeModel[None]
Actual results:
at least bad exception raised

Expected results:
either TypeError("could not parse subscript '%s' as a tree path" % path) should be raised or this call should return None

Additional info:
I can provide a patch, but I don't know which of abovementioned solutions would be better
Comment 1 Fedora End Of Life 2013-01-16 09:08:26 EST
This message is a reminder that Fedora 16 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 16. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '16'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 16's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 16 is end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" and open it against that version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
Comment 2 Fedora End Of Life 2013-02-13 10:10:07 EST
Fedora 16 changed to end-of-life (EOL) status on 2013-02-12. Fedora 16 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.