From 9a851df678de4a9b1a1f41bdc2bd7dc32f9cecf6 Mon Sep 17 00:00:00 2001
From: Roland Ernst <rcrernst@gmail.com>
Date: Mon, 23 Dec 2019 16:07:10 +0100
Subject: [PATCH 1/4] Fix typo in in class OrdDict of altdict.py
When deleting an entry of the settings table, a traceback is raised:
$ python
>>> from MythTV import MythDB
>>> db = MythDB()
>>> host = db.getMasterBackend()
>>> db.settings[host][u"mailTO"] = u"justme@gmail.com"
>>> db.settings[host][u"mailTO"]
'justme@gmail.com'
>>> del db.settings[host][u"mailTO"]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/admin/MythTV/MythTV_python/MythTV/database.py", line 1222, in __delitem__
OrdDict.__delitem__(self, key)
File "/home/admin/MythTV/MythTV_python/MythTV/altdict.py", line 48, in __delitem__
dict.__delitem(self, key)
AttributeError: type object 'dict' has no attribute '_OrdDict__delitem'
Solution: change '__delitem' to '__delitem__'
With that change it works like expected:
$ python
>>> from MythTV import MythDB
>>> db = MythDB()
>>> host = db.getMasterBackend()
>>> db.settings[host][u"mailTO"] = u"justme@gmail.com"
>>> db.settings[host][u"mailTO"]
'justme@gmail.com'
>>> del db.settings[host][u"mailTO"]
>>> db.settings[host][u"mailTO"]
>>>
---
mythtv/bindings/python/MythTV/altdict.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mythtv/bindings/python/MythTV/altdict.py b/mythtv/bindings/python/MythTV/altdict.py
index ed41c2c0f4..a90e9c3baa 100644
a
|
b
|
class OrdDict( dict ): |
45 | 45 | del self[name] |
46 | 46 | |
47 | 47 | def __delitem__(self, key): |
48 | | dict.__delitem(self, key) |
| 48 | dict.__delitem__(self, key) |
49 | 49 | self._field_order.remove(key) |
50 | 50 | |
51 | 51 | def __iter__(self): |