ParseSection(control).get(field, default) raises when default is None

Bug #44470 reported by Robert Collins
6
Affects Status Importance Assigned to Milestone
python-apt (Ubuntu)
Fix Released
Medium
Michael Vogt

Bug Description

A common idiom in python is to be able to do:
dictionary.get(key, default)

default here is often None, or some sensible default. python-apt is confusing because a default of None raises, and this means that clients cannot as easily discriminate between an empty control field and a missing one.

Michael Vogt (mvo)
Changed in python-apt:
assignee: nobody → mvo
status: New → Fix Committed
Revision history for this message
Michael Vogt (mvo) wrote :

python-apt (0.7.4ubuntu1) hardy; urgency=low

  * merged from debian/unstable, remaining changes:
   - rebuild against latest apt
   - maintainer field changed

python-apt (0.7.4) unstable; urgency=low

  * apt/debfile.py:
    - added wrapper around apt_inst.debExtract()
    - support dictionary like access
  * apt/package.py:
    - fix apt.package.Dependency.relation initialization
  * python/apt_instmodule.cc:
    - added arCheckMember()
    - fix typo
  * aptsources/distro.py:
    - throw NoDistroTemplateException if not distribution template
      can be found
  * python/string.cc:
    - fix overflow in SizeToStr()
  * python/metaindex.cc:
    - added support for the metaIndex objects
  * python/sourceslist.cc:
    - support new "List" attribute that returns the list of
      metaIndex source entries
  * python/depcache.cc:
    - be more threading friendly
  * python/tag.cc
    - support "None" as default in
      ParseSection(control).get(field, default), LP: #44470
  * python/progress.cc:
    - fix refcount problem in OpProgress
    - fix refcount problem in FetchProgress
    - fix refcount problem in CdromProgress
  * apt/README.apt:
    - fix typo (thanks to Thomas Schoepf, closes: #387787)
  * po/fr.po:
    - merge update, thanks to Christian Perrier (closes: #435918)
  * data/templates/:
    - update templates

 -- Michael Vogt <email address hidden> Thu, 13 Dec 2007 15:00:22 +0100

Changed in python-apt:
status: Fix Committed → Fix Released
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.