summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Vagelpohl <jens@netz.ooo>2004-04-07 17:43:31 +0000
committerJens Vagelpohl <jens@netz.ooo>2004-04-07 17:43:31 +0000
commit766c1638c5d58851f305d031155f19b82db661a8 (patch)
treea858842db6cedcdf6659f6686d66869322b7e26b
parent8c3334fc6a73b80fd0e871db9aebab364280998d (diff)
downloadViewsManager-766c1638c5d58851f305d031155f19b82db661a8.zip
ViewsManager-766c1638c5d58851f305d031155f19b82db661a8.tar.gz
- Implemented a sortKey method for the TransactionalEmail class
to satisfy a new ZODB requirement (JTracker issue 369 by Maik Jablonski) - Stop using os.tempnam for creating a temporary file name, it always spews warnings into the log.
-rw-r--r--CHANGES.txt12
-rw-r--r--MaildropHost.py17
2 files changed, 22 insertions, 7 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 13da612..ebbd06f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,17 @@
MaildropHost version and change information
+ 1.4
+
+ * Bugs fixed:
+
+ - Implemented a sortKey method for the TransactionalEmail class
+ to satisfy a new ZODB requirement (JTracker issue 369 by Maik
+ Jablonski)
+
+ - Stop using os.tempnam for creating a temporary file name, it
+ always spews warnings into the log.
+
+
1.3
* Features added:
diff --git a/MaildropHost.py b/MaildropHost.py
index 645d034..cb3d5e6 100644
--- a/MaildropHost.py
+++ b/MaildropHost.py
@@ -26,14 +26,10 @@ if not os.path.isdir(MAILDROP_SPOOL):
def makeTempPath():
""" Helper to create a temp file name safely """
- # no 'tempnam' attribute in DOS, so fall back to using random
- if hasattr(os, 'tempnam'):
- temp_path = os.tempnam(MAILDROP_SPOOL)
- else:
- temp_path = os.path.join(MAILDROP_SPOOL, str(randint(1000000, 99999999)))
+ temp_path = os.path.join(MAILDROP_SPOOL, str(randint(100000, 9999999)))
- while os.path.exists(temp_path):
- temp_path = os.path.join(MAILDROP_SPOOL, str(randint(1000000, 99999999)))
+ while os.path.exists(temp_path):
+ temp_path = os.path.join(MAILDROP_SPOOL, str(randint(100000, 9999999)))
return temp_path
@@ -213,6 +209,13 @@ class TransactionalEmail:
self._tempfile = ''
+ def sortKey(self, *ignored):
+ """ The sortKey method is used for recent ZODB compatibility which
+ needs to have a known commit order for lock acquisition.
+ I don't care about commit order, so return the constant 1
+ """
+ return 1
+
MAIL_TEMPLATE = """##To:%s
##From:%s