Thanks, Karen!

-Drew

On 5/2/12 1:25 PM, Karen Tung wrote:
Everything looks good to me now after you make the change below.

--Karen

On 05/ 2/12 09:30 AM, Drew Fisher wrote:
Karen noticed a small issue with the strip() fix. I wasn't saving the stripped result after testing for it.

The from_xml has changed slightly to:

-        name = element.get(cls.NAME_LABEL)
+        name = element.get(cls.NAME_LABEL).strip()
+        if not name:
+            raise ParsingError("distribution name must not be blank")
+


Remember that name *must* be present. If it's omitted, the name attribute will come back as None, and that's handled in the can_handle method:


        if element.get(cls.NAME_LABEL) is None:
            return False

so it's safe to put a strip() call there.

-Drew



On 5/2/12 8:45 AM, Drew Fisher wrote:


On 5/2/12 12:48 AM, Karen Tung wrote:
Hi Drew,

On 05/ 1/12 07:07 AM, Drew Fisher wrote:
name can never be None because of the code in can_handle:

        if element.get(cls.NAME_LABEL) is None:
            return False

Good catch on the empty spaces.  I'll toss a strip() call in there:

if not name.strip():
    raise ...

Is "my test distro" a valid name? If so, a simple name.strip() will remove the spaces.
If that's not a valid name, should we check for that as well?

"my test distro" is a valid name. I just tested running a full DC run with that as the distro name:

<snip>
08:37:38    === Executing Create ISO Checkpoint ==
08:37:38 Making final ISO image: /rpool/cr_7163019/dc/ai/media/my test distro.iso
08:37:53    === Executing Create USB Checkpoint ===
08:37:53 Making final USB image: /rpool/cr_7163019/dc/ai/media/my test distro.usb
<snip>
[mox:src] > ls -lh /rpool/cr_7163019/dc/ai/media/my\ test\ distro.*
-rw-r--r-- 1 root root 302M May 2 08:37 /rpool/cr_7163019/dc/ai/media/my test distro.iso -r--r--r-- 1 root root 363M May 2 08:38 /rpool/cr_7163019/dc/ai/media/my test distro.usb


Also, str.strip() only removes whitespace from either end of the string. It does not remove whitespace in the middle. I've added a second test to this CR which tests an entire string of random whitespace to test the strip() call.

Newest webrev is here and contains fixes from Dermot and Jack comments:

https://cr.opensolaris.org/action/browse/caiman/drewfish/7163019_2/webrev/

-Drew




_______________________________________________
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