Michal,

I do not like the way you are catching the Runtime exceptions and 
parsing the error string to take specific actions. You need to work with 
Brock to get the appropriate Exceptions raised for permission denied and 
no defined authorities. This might be a problem getting it sorted for 
RC1.5 but it would be a lot more robust.


 363      -                        except RuntimeError:
      365 +                        except RuntimeError, ex:
      366 +                                if "Permission denied" in str(ex):
      367 +                                        # Do nothing
      368 +                                        err = strt("Failed to modify 
%s." % omn + \
      369 +                                            "\nPlease check your 
permissions.")
      370 +                                        
gobject.idle_add(self.__error_occured, err)
      371 +                                        sel = None
      372 +                                        selection = 
self.w_repository_treeview.get_selection()
      373 +                                        model, ite = 
selection.get_selected()
      374 +                                        if ite:
      375 +                                                sel = 
model.get_value(ite, 0)
      376 +                                        
self.__prepare_repository_list(False, sel)
      377 +                                        return
      378 +                                elif "no defined authorities" in 
str(ex):
      379 +                                        pass
      380 +                                else:
      381 +                                        err = str(ex)
      382 +                                        
gobject.idle_add(self.__error_occured, err)
      383 +                                        sel = None
      384 +                                        selection = 
self.w_repository_treeview.get_selection()
      385 +                                        model, ite = 
selection.get_selected()
      386 +                                        if ite:
      387 +                                                sel = 
model.get_value(ite, 0)
      388 +                                        
self.__prepare_repository_list(False, sel)
      389 +                                        return
 

This code is duplicated in several places 371, 381 and 403, should be a 
function, reset_repo_selection().

      371 +                                        sel = None
      372 +                                        selection = 
self.w_repository_treeview.get_selection()
      373 +                                        model, ite = 
selection.get_selected()
      374 +                                        if ite:
      375 +                                                sel = 
model.get_value(ite, 0)
      376 +                                        
self.__prepare_repository_list(False, sel)
      377 +                                        return


JR

Michal Pryc wrote:
> John,
> I have made small change in the packagemanager.py to reflect your wishes :)
>
> http://cr.opensolaris.org/~migi/12_10_2008_bug_4884_v3
>
> best
> Michal
>
> jmr wrote:
>   
>> Michal - just testing this and when I change to osol-re I no longer get
>> the crash, but on restart I now have no Categories. Looking at
>> packagemanager.py 1515 I can see that the category file is expected to
>> be the authority name and this does not exist in
>> /usr/share/package-manager/data/osol-re, so no categories are loaded.
>>
>> If a repo delivered their own category file then this would work, but
>> where one does not exist you should be falling back to use the
>> opensolaris.og ones.
>>
>> I'll review the rest of the code.
>>
>> JR
>>
>>
>> Michal Pryc wrote:
>>     
>>> Hi,
>>> http://cr.opensolaris.org/~migi/12_10_2008_bug_4884_v1/
>>>
>>> Basically we were not recovering properly from the situation when
>>> there was only one repository and this repository was modified.
>>>
>>> best
>>> Michal
>>> _______________________________________________
>>> pkg-discuss mailing list
>>> [email protected]
>>> http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
>>>       
>
> _______________________________________________
> pkg-discuss mailing list
> [email protected]
> http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
>   

_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to