[sysadmin-bin] ftpadmin: always show header in notification msg, just kill the line with the version number and any
- From: Olav Vitters <ovitters src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] ftpadmin: always show header in notification msg, just kill the line with the version number and any
- Date: Mon, 28 Mar 2011 08:29:48 +0000 (UTC)
commit ed73331337119769609ac81064f4571742ae28ce
Author: Olav Vitters <olav vitters nl>
Date: Mon Mar 28 10:29:42 2011 +0200
ftpadmin: always show header in notification msg, just kill the line with the version number and any header/empty lines
ftpadmin | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/ftpadmin b/ftpadmin
index e85429e..32af25a 100755
--- a/ftpadmin
+++ b/ftpadmin
@@ -20,6 +20,7 @@ import subprocess
import argparse
import errno
import glob
+import string
from email.mime.text import MIMEText
import json
try:
@@ -1041,10 +1042,21 @@ Install %s? [Y/n]""" % self.module,
path, realpath, size, stat = info
if show_contents and stat.st_size < 50000:
with open(realpath, 'r') as f:
+ do_version = True
+ stripchars = "".join((string.punctuation, string.whitespace))
line = f.readline()
- if not self.version in line:
- self._print_header(mail, formatname)
- print >>mail, ""
+ while line != '' and (line.strip(stripchars) == '' \
+ or (do_version and self.version in line)):
+ if self.version in line:
+ do_version = False
+ line = f.readline()
+
+ if line == '':
+ # No interesting line in this file, ignore it
+ continue
+
+ self._print_header(mail, formatname)
+ print >>mail, ""
mail.write(line)
shutil.copyfileobj(f, mail)
else:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]