On 08/10/2009 05:26 PM, Peter Jones wrote:
On 08/10/2009 09:11 AM, Hans de Goede wrote:
This patch fixes the (stupid) traceback in booty/util.py getDiskPart()
from 505205, by checking all characters after the cut point are digits before
assuming we have found a place to cut between partition number and disk.
---
booty/util.py | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/booty/util.py b/booty/util.py
index 4128705..2b79730 100644
--- a/booty/util.py
+++ b/booty/util.py
@@ -4,19 +4,20 @@ from flags import flags
def getDiskPart(dev, storage):
path = storage.devicetree.getDeviceByName(dev).path[5:]
cut = len(dev)
- if (path.startswith('rd/') or path.startswith('ida/') or
- path.startswith('cciss/') or path.startswith('sx8/') or
- path.startswith('mapper/') or path.startswith('mmcblk') or
- path.startswith('md')):
- if dev[-2] == 'p':
- cut = -1
- elif dev[-3] == 'p':
- cut = -2
- else:
- if dev[-2] in string.digits:
- cut = -2
- elif dev[-1] in string.digits:
- cut = -1
+ if dev[-1] in string.digits:
+ if (path.startswith('rd/') or path.startswith('ida/') or
+ path.startswith('cciss/') or path.startswith('sx8/') or
+ path.startswith('mapper/') or path.startswith('mmcblk') or
+ path.startswith('md')):
What's the point of the extra set of parens here?
Well it was already there I just indented the block, but besides that I believe
the point is that if you have a ( without a matching ) you can continue the statement
on the next line without needing to add a \ at the end of the line. To me the '('
solution is more aesthetically pleasing.
Regards,
Hans
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list