OK, so the diff looks like this now:

diff -r 15ba29ecb4ed -r c6eff787b038 usr/src/lib/install_transfer/info.py
--- a/usr/src/lib/install_transfer/info.py      Tue Apr 24 11:31:32 2012 -0600
+++ b/usr/src/lib/install_transfer/info.py      Tue Apr 24 23:53:11 2012 +0100
@@ -655,9 +655,11 @@ class IPSSpec(DataObject):
         for pkg in self.contents:
             sub_element = etree.SubElement(element, IPSSpec.IPS_NAME_LABEL)
             sub_element.text = pkg
-        for pkg in self.reject_list:
-            sub_element = etree.SubElement(element, IPSSpec.IPS_REJECT_LABEL)
-            sub_element.text = pkg
+        if self.reject_list is not None:
+            for pkg in self.reject_list:
+                sub_element = etree.SubElement(element,
+                                               IPSSpec.IPS_REJECT_LABEL)
+                sub_element.text = pkg
         return element

     @classmethod


Thanks,

Darren.

On 24/04/2012 23:49, Drew Fisher wrote:
> I'm fine with that too
> 
> NIT:  if self.reject_list is not None ....
> 
> -Drew
> 
> On 4/24/12 4:45 PM, Darren Kenny wrote:
>> If you feel this is better, then I would prefer to just leave it as
>> None, and later in the to_xml() do a test for None rather than just
>> iterating over it:
>>
>>      if self.reject_list:
>>          for ...
>>
>> What do you think?
>>
>> Thanks,
>>
>> Darren.
>>
>> On Tue Apr 24 23:43:04 2012, Drew Fisher wrote:
>>> Passing an empty list (or any mutable object) in as a default arg is
>>> sort of a no-no.  The default value for reject_list is allocated when
>>> the class is created, not when it's called.
>>>
>>> I think it would be better to leave it as None, but then in __init__,
>>> check for None:
>>>
>>> def __init__(self, .... reject_list=None, .....):
>>>
>>> <....>
>>>       if reject_list is None:
>>>           reject_list = list()
>>>
>>>
>>> This way we're protected.
>>>
>>> I know the odds of us hitting something here is low, but I'd be safe
>>> than sorry.  If you do decide to take up this change, no follow-up
>>> webrev is necessary.
>>>
>>> -Drew
>>>
>>>
>>>
>>> On 4/24/12 4:30 PM, Darren Kenny wrote:
>>>> Hi,
>>>>
>>>> Could I please get a quick review for this fix for the bug:
>>>>
>>>>    7164012 putback of 7145997 breaks text-installs
>>>>
>>>> The code changes are below, no need for a webrev really.
>>>>
>>>> I'm in the process of testing this fix now - I've already seen that it
>>>> fixes the TI install, but I need to test other images (being built now) 
>>>> too.
>>>>
>>>> I don't expect this to have any impact on AI since the code-path differs in
>>>> that the from_xml is used to process the<software_data>   and thus
>>>> initializes things to a list(), which is why it's to_xml() didn't crash.
>>>>
>>>> Thanks,
>>>>
>>>> Darren
>>>>
>>>> -------------------------------------------------------------------------
>>>>
>>>> diff -r 15ba29ecb4ed -r 8af35f2241c7 usr/src/lib/install_transfer/info.py
>>>> --- a/usr/src/lib/install_transfer/info.py      Tue Apr 24 11:31:32 2012 
>>>> -0600
>>>> +++ b/usr/src/lib/install_transfer/info.py      Tue Apr 24 23:19:31 2012 
>>>> +0100
>>>> @@ -633,7 +633,7 @@ class IPSSpec(DataObject):
>>>>        INSTALL = "install"
>>>>        UNINSTALL = "uninstall"
>>>>
>>>> -    def __init__(self, action=None, contents=None, reject_list=None,
>>>> +    def __init__(self, action=None, contents=None, reject_list=list(),
>>>>                     app_callback=None, purge_history=False):
>>>>            super(IPSSpec, self).__init__(IPSSpec.IPS_TRANSFER_LABEL)
>>>>            self.action = action
>>>>    
>>>> _______________________________________________
>>>> caiman-discuss mailing list
>>>> [email protected]
>>>> http://mail.opensolaris.org/mailman/listinfo/caiman-discuss
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss

Reply via email to