summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7bb62a9)
raw | patch | inline | side by side (parent: 7bb62a9)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 11 Nov 2003 22:37:25 +0000 (22:37 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 11 Nov 2003 22:37:25 +0000 (22:37 +0000) |
template (sf bug 827510)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1978 57a73879-2fb5-44c3-a270-3262357dd7e2
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1978 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/install_util.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index e6ed2be369d50a8f27292901906df954b0323b44..a8fbbef5e649a1ce84c95daf1d4a84bfeab239b2 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
(bug #821364).
- Centralised conversion of user-input data to hyperdb values (bug #802405,
bug #817217, rfe #816994)
+- recalculate SHA on template files when installed tracker used as
+ template (sf bug 827510)
Cleanup:
- Replace curuserid attribute on Database with the extended getuid() method.
index e54dc933ee8c8883072cc19a1c061cf223a321b0..4e07a5b464b801442204ab72bdceb976bef34460 100644 (file)
--- a/roundup/install_util.py
+++ b/roundup/install_util.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: install_util.py,v 1.8 2002-09-10 00:18:20 richard Exp $
+# $Id: install_util.py,v 1.9 2003-11-11 22:37:25 richard Exp $
__doc__ = """
Support module to generate and check fingerprints of installed files.
digested_file_types = sgml_file_types + hash_file_types + slast_file_types
-
-def checkDigest(filename):
- """Read file, check for valid fingerprint, return TRUE if ok"""
- # open and read file
- inp = open(filename, "r")
- lines = inp.readlines()
- inp.close()
-
+def extractFingerprint(lines):
# get fingerprint from last line
- if lines[-1][:6] == "#SHA: ":
+ if lines[-1].startswith("#SHA: "):
# handle .py/.sh comment
- fingerprint = lines[-1][6:].strip()
- elif lines[-1][:10] == "<!-- SHA: ":
+ return lines[-1][6:].strip()
+ elif lines[-1].startswith("<!-- SHA: "):
# handle xml/html files
fingerprint = lines[-1][10:]
fingerprint = fingerprint.replace('-->', '')
- fingerprint = fingerprint.strip()
- elif lines[-1][:8] == "/* SHA: ":
+ return fingerprint.strip()
+ elif lines[-1].startswith("/* SHA: "):
# handle css files
fingerprint = lines[-1][8:]
fingerprint = fingerprint.replace('*/', '')
- fingerprint = fingerprint.strip()
- else:
+ return fingerprint.strip()
+ return None
+
+def checkDigest(filename):
+ """Read file, check for valid fingerprint, return TRUE if ok"""
+ # open and read file
+ inp = open(filename, "r")
+ lines = inp.readlines()
+ inp.close()
+
+ fingerprint = extractFingerprint(lines)
+ if fingerprint is None:
return 0
del lines[-1]
self.file = open(self.filename, "w")
def write(self, data):
+ lines = data.splitlines()
+ # if the file is coming from an installed tracker being used as a
+ # template, then we will want to re-calculate the SHA
+ fingerprint = extractFingerprint(lines)
+ if fingerprint is not None:
+ data = '\n'.join(lines[:-1]) + '\n'
self.file.write(data)
self.digest.update(data)