[Yum-devel] [PATCH] [RFC]

Tim Lauridsen tim.lauridsen at googlemail.com
Thu Feb 21 10:10:45 UTC 2008


i have some problems with using YumBase.searchGenerator from the 
PackageKit yum2 backend (dbus based backend).

       searchlist = ['name', 'summary', 'description', 'group']
       key = 'firmware'			
       res = self.yumbase.searchGenerator(searchlist, [key])
       for (pkg,values) in res:
	# do some action

i get this

org.freedesktop.DBus.Python.UnicodeDecodeError: Traceback (most recent 
call last):
   File "/usr/lib/python2.5/site-packages/dbus/service.py", line 655, in 
_message_cb
     retval = candidate_method(self, *args, **keywords)
   File "./yumDBUSBackend.py", line 388, in SearchDetails
     successful = self._do_search(searchlist, filters, key)
   File "./yumDBUSBackend.py", line 1014, in _do_search
     for (pkg,values) in res:
   File 
"/data/udv/work/PackageKit/backends/yum2/helpers/yum/__init__.py", line 
1488, in searchGenerator
     if value and value.lower().find(s) != -1:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 19: 
ordinal not in range(128)

if is caused because value is a bytestring contain a non ascii char.

i can only reproduce it if the code is call from a dbus method, it works 
fine if i run the code as a normal python script.

the attached patch fixes the issue, does any body have any objection to 
commit the patch.

Tim


-------------- next part --------------
A non-text attachment was scrubbed...
Name: search-generator-unicode.patch
Type: text/x-patch
Size: 628 bytes
Desc: not available
Url : http://lists.baseurl.org/pipermail/yum-devel/attachments/20080221/527aa7bf/attachment.bin 


More information about the Yum-devel mailing list