
libvirt-cim-bounces@redhat.com wrote on 2008-10-10 14:11:37:
Guo Lian Yun wrote:
libvirt-cim-bounces@redhat.com wrote on 2008-10-09 23:15:10:
+bug = "00007" +expr_values = { + "invalid_ccname" : {"rc" : pywbem.CIM_ERR_NOT_FOUND,
\
+ "desc" : "No such instance (CreationClassName)"}, + "invalid_name" : {"rc" : pywbem.CIM_ERR_NOT_FOUND, \ + "desc" : "No such instance (Name)"} + }
Can you align the lines so that the colons line up. Like:
Sure. I will rewrite it.
"invalid_ccname" : {"rc" : pywbem.CIM_ERR_NOT_FOUND, \ "desc" : "No such instance (CreationClassName)"},
Also, remove the \ at the end of these lines above.
+ ret = try_assoc(conn, classname, assoc_classname, keys, \
Remove \ at the end of the line.
+ ret = try_assoc(conn, classname, assoc_classname, keys, \
Same here - remove the \ at the end of the line.
Would you please tell me when I have to add \ at the end of line? And when it doesn't need.
It would be easy to tell you where we need not have to add a \ than where to add it :). We dont have to add a \ after a comma in case of functions or in case of lists or dictionary above. for ex in case of the above try_assoc() we do not need a \ after the keys param. We need to add a \ at the end of the line only in case we cannot complete the statement within 80 columns.
For ex: logger.error("HostedService associator should NOT return excepted result with a wrong key name and value of %s input" % k)
The above log stmt would not fit in the 80 columns in a single line and hence we would require the stmt to be continued on the next line, we can do it using the \ as below:
logger.error("HostedService associator should NOT return excepted result with \ a wrong key name and value of %s input" % k)
But in case you do not want to use the \ you can write the above in the following way
logger.error("HostedService associator should NOT return excepted result with " "a wrong key name and value of %s input" % k)
The same thing applies if the element of the list does not accommodate in a single line within 80 columns.
For ex:
expr_values = { "invalid_ccname" : {"rc" : pywbem.CIM_ERR_NOT_FOUND, "desc": "No such instance "\ (CreationClassName)"}}
For ex above we do not need a \ after the value pywbem. CIM_ERR_NOT_FOUND of rc key in the list. But we would require a \ to complete the value "No such instance (CreationClassName)" of the key desc above. Again, as in the logger stmt we can write the above without the \ as follows:
expr_values = { "invalid_ccname" : { "rc" : pywbem.CIM_ERR_NOT_FOUND, "desc" : "No such instance " "(CreationClassName)"}}
The rule of using \ applies almost like in the C language, for ex in the pre processor stmts we make use of the \ if we are not able to complete the stmt in a single line. But we dont use it in case of function parameters distributed over 2 different lines.
Hope this helps.
Deepti, I'm much grateful of your explanation. It's really helpful to me. Thanks!
Thanks and Regards, Deepti.
Thanks!
-- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim _______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim