notes now have a timestamp column.
do not allow to edit old notes, only add new ones
hand over existing notes (if any) to the reject message (unless we get called with -m)
hand over existing notes (if any) to the prod message
Signed-off-by: Joerg Jaspert <joerg@debian.org>
--- /dev/null
+#!/usr/bin/env python
+# coding=utf8
+
+"""
+Adding a date field to the process-new notes
+
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2009 Joerg Jaspert <joerg@debian.org>
+@license: GNU General Public License version 2 or later
+"""
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+################################################################################
+
+
+################################################################################
+
+import psycopg2
+import time
+
+################################################################################
+
+def do_update(self):
+ print "Adding a date field to the process-new notes"
+
+ try:
+ c = self.db.cursor()
+ c.execute("ALTER TABLE new_comments ADD COLUMN notedate TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()")
+
+ c.execute("UPDATE config SET value = '12' WHERE name = 'db_revision'")
+ self.db.commit()
+
+ except psycopg2.ProgrammingError, msg:
+ self.db.rollback()
+ raise DBUpdateError, "Unable to apply process-new update 12, rollback issued. Error message : %s" % (str(msg))
def edit_note(note):
# Write the current data to a temporary file
(fd, temp_filename) = utils.temp_filename()
- temp_file = os.fdopen(fd, 'w')
- if len(note) > 0:
- for line in note:
- temp_file.write(line)
- temp_file.close()
editor = os.environ.get("EDITOR","vi")
answer = 'E'
while answer == 'E':
os.system("%s %s" % (editor, temp_filename))
temp_file = utils.open_file(temp_filename)
- note = temp_file.read().rstrip()
+ newnote = temp_file.read().rstrip()
temp_file.close()
- print "Note:"
+ print "New Note:"
print utils.prefix_multi_line_string(note," ")
prompt = "[D]one, Edit, Abandon, Quit ?"
answer = "XXX"
elif answer == 'E' and not Options["Trainee"]:
new = edit_overrides (new)
elif answer == 'M' and not Options["Trainee"]:
- aborted = Upload.do_reject(1, Options["Manual-Reject"])
+ aborted = Upload.do_reject(manual=1,
+ reject_message=Options["Manual-Reject"],
+ note=database.get_new_comments(changes.get("source", "")))
if not aborted:
os.unlink(Upload.pkg.changes_file[:-8]+".dak")
done = 1
elif answer == 'N':
edit_note(database.get_new_comments(changes.get("source", "")))
elif answer == 'P' and not Options["Trainee"]:
- prod_maintainer()
+ prod_maintainer(database.get_new_comments(changes.get("source", "")))
elif answer == 'R':
confirm = utils.our_raw_input("Really clear note (y/N)? ").lower()
if confirm == "y":
Cnf = None
projectB = None
-required_database_schema = 11
+required_database_schema = 12
################################################################################
"""
comments = []
- query = projectB.query(""" SELECT version, comment, author
+ query = projectB.query(""" SELECT version, comment, author, notedate
FROM new_comments
- WHERE package = '%s' """ % (package))
+ WHERE package = '%s'
+ ORDER BY notedate
+ """ % (package))
for row in query.getresult():
- comments.append("\nAuthor: %s\nVersion: %s\n\n%s\n" % (row[2], row[0], row[1]))
+ comments.append("\nAuthor: %s\nVersion: %s\nTimestamp: %s\n\n%s\n" % (row[2], row[0], row[4], row[1]))
comments.append("-"*72)
return comments
###########################################################################
- def do_reject (self, manual = 0, reject_message = ""):
+ def do_reject (self, manual = 0, reject_message = "", note = ""):
"""
Reject an upload. If called without a reject message or C{manual} is
true, spawn an editor so the user can write one.
# editor so the user can add one in...
if manual and not reject_message:
(fd, temp_filename) = utils.temp_filename()
+ temp_file = os.fdopen(fd, 'w')
+ if len(note) > 0:
+ for line in note:
+ temp_file.write(line)
+ temp_file.close()
editor = os.environ.get("EDITOR","vi")
answer = 'E'
while answer == 'E':