Michael Pasternak has posted comments on this change.

Change subject: cli: Don't write .0 suffix for integers
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.ovirt.org/#/c/26864/1/src/ovirtcli/format/text.py
File src/ovirtcli/format/text.py:

Line 126:         else:
Line 127:             val = str(value)
Line 128: 
Line 129:         # Don't write the .0 suffix for floating point number whose 
value is
Line 130:         # actually an integer:
> This change doesn't change the value of any thing, float or int, it only ch
> This change doesn't change the value of any thing, float or int, it only 
> changes 

> the external representation, 

indeed, you will always represent "int" (also as mentioned before it will not 
work on every float) where api might show float, so you'll end up with 
inconsistent representation between api/engine & cli.

> so that the useless and confusing .0 isn't 

> presented. It solves the bug without negative side effects.

it will fix your edge case by forcing all floats to be represented differently, 

> The type/representation used by the API can't be changed without breaking 

> backwards compatibility. Same for the SDKs.

unless it's a bug ...,  all in all i'm fine fixing it in cli if you will, but 
by:

1. precise fix for Statistics object where Statistics.type==INTEGER
2. by casting "float" to "int" (rather than string manipulation removing single 
char
   after period)

thanks.
Line 131:         if type(value) == float and val.endswith('.0'):
Line 132:             val = val[:-2]
Line 133: 
Line 134:         fil = (field if resource_context is None


-- 
To view, visit http://gerrit.ovirt.org/26864
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I21490ec50e3a7433331e981162de800c7d548f27
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-cli
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <[email protected]>
Gerrit-Reviewer: Juan Hernandez <[email protected]>
Gerrit-Reviewer: Michael Pasternak <[email protected]>
Gerrit-Reviewer: Ravi Nori <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to