issue with 'QPyNullVariant' in parsing settings

Bug #1095268 reported by matysek
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenLP
Fix Released
Low
matysek

Bug Description

Someone in a comment reported the following issue:

Traceback (most recent call last):
  File "openlp/core/ui/generaltab.py", line 277, in load
    self.numberEdit.setText(settings.value(u'ccli number', u''))
TypeError: QLineEdit.setText(QString): argument 1 has unexpected type 'QPyNullVariant'

Steps to reproduce:
1. run openlp
2. Open settings
3. change something on general tab
4. save it and then you'll get the previous traceback.

Symptoms:
- OSX, latest openlp dev tree
- not sure if osx specific
- Qt 4.8.3, PyQt 4.9.4 and PyQt 4.9.6
- happens only in parsing saved QSettings - with clean install openlp starts but not the second time.
- bug appeared after the 'QString and QVariant auto-conversion' merge

Investigation:
- setting with empty value is not converted to 'None' but to type QPyNullVariant while reading.

How to fix:
- The method 'Setting.value()' should
  - convert QPyNullVariant to None if QPyNullVariant.isNull() == True
  - convert None to empty string if defaultValue type is string

Some links:
http://python.6.n6.nabble.com/QPyNullVariant-td4981824.html

Related branches

matysek (mzibricky)
description: updated
matysek (mzibricky)
Changed in openlp:
status: New → Fix Committed
Tim Bentley (trb143)
Changed in openlp:
status: Fix Committed → Fix Released
Changed in openlp:
status: Fix Released → Fix Committed
Tim Bentley (trb143)
Changed in openlp:
importance: Undecided → Low
Tim Bentley (trb143)
Changed in openlp:
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.