Blob Blame History Raw
From 9ed78be49ce54a69b72af1bcd54f093218570e20 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Mon, 13 Jul 2015 10:35:29 +0200
Subject: [PATCH] Fix an exception when searching for a bug ID

The encode() function returns 'bytes' but that is useless and wrong in
our case, because we just need to get 'str' from 'DBus.String' to be
able to call the 'in' operator (the operator does not work for 'str' in
'DBus.String').

Related: rhbz#1211083, rhbz#1242080

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
 src/gnome_abrt/views.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gnome_abrt/views.py b/src/gnome_abrt/views.py
index a1e684b..fb4c6e0 100644
--- a/src/gnome_abrt/views.py
+++ b/src/gnome_abrt/views.py
@@ -105,7 +105,9 @@ class ProblemsFilter(object):
                 if problems.Problem.Submission.URL != sbm.rtype:
                     continue
 
-                rid = sbm.data.encode('utf-8')
+                # _pattern is 'str' and sbm.data is 'dbus.String', so we need
+                # to convert sbm.data to a regular 'str'
+                rid = str(sbm.data)
                 rid = rid.rstrip('/').split('/')[-1].split('=')[-1]
                 if self._pattern in rid:
                     return True
-- 
2.4.5