Patch: A fix for TMDA-cgi so it works with TMDA-0.1.10

Jim Ramsay <[email protected]>
Newsgroups gmane.mail.spam.tmda.user
Message-ID <[email protected]>
This fixes the wonderfully confusing error message:

tmda-cgi/0.15 requires TMDA/1.1.6 or later. TMDA/1.1.10 found.

This should probably work with earlier versions of TMDA-cgi as well
(although this is untested).

To apply:

1. Save the attachment somewhere, such as /tmp

2. CD into the directory where the tmda-cgi source is kept.

3. Run the following command as root (or whoever is allowed to make
changes in the tmda-cgi directory:

   patch -p0 < /tmp/tmda-cgi-0.15-TMDA_Version_Fix.patch

If you saved the patch somewhere besides /tmp, replace '/tmp' in the
command above with the full path to the patch file.

That should do it.

Enjoy!

-- 
Jim Ramsay
"Me fail English?  That's unpossible!"
tmda-cgi-0.15-TMDA_Version_Fix.patch (text/x-patch, 955 B)
Index: CgiVersion.py
===================================================================
--- CgiVersion.py	(revision 2114)
+++ CgiVersion.py	(working copy)
@@ -43,9 +43,25 @@
 All = 'tmda-cgi/%s "%s" (Python/%s on %s)' % \
   (tmda_cgi, Codename, Python, Platform)
 
+def parseVersion(versionString):
+	"""Returns a list of all the integers in the version string:
+		"1.1.3" will return [1,1,3,0]
+		"1.1.0+" will return [1,1,0,1]"""
+	if versionString.endswith("+"):
+		string = versionString[:-1]
+		dev = 1
+	else:
+		dev = 0
+		string = versionString
+	tuple = [ int(x) for x in string.split(".") ]
+	tuple.append(dev)
+	return tuple
+
 def Test():
   "Validate TMDAReqVer."
-  if Version.TMDA < TMDAReqVer:
+  current = parseVersion(Version.TMDA)
+  required = parseVersion(TMDAReqVer)
+  if current < required:
     raise ImportError, \
       "tmda-cgi/%s requires TMDA/%s or later.  TMDA/%s found." % \
       (tmda_cgi, TMDAReqVer, Version.TMDA)
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.1 (GNU/Linux)

iD8DBQFFyzz0elWXok6VKugRAoXdAKDakd1vNAQPtKIqy02vWftu3EvCQwCgnlRA
1S56VuMJ/jX05MmdN+LSrMk=
=QeXC
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.