summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorbwarsaw1999-11-24 19:50:17 +0000
committerbwarsaw1999-11-24 19:50:17 +0000
commit8a087452b5e415a9f29e1a020cb986893ae5cf84 (patch)
tree15967839e7762dbc4afba160807a089b34c47176 /scripts
parentc40dda2319c28bb681faaa60805ba3d2a02aa344 (diff)
downloadmailman-8a087452b5e415a9f29e1a020cb986893ae5cf84.tar.gz
mailman-8a087452b5e415a9f29e1a020cb986893ae5cf84.tar.zst
mailman-8a087452b5e415a9f29e1a020cb986893ae5cf84.zip
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/mailowner36
-rwxr-xr-xscripts/owner36
2 files changed, 40 insertions, 32 deletions
diff --git a/scripts/mailowner b/scripts/mailowner
index e53c71201..0e90d8562 100755
--- a/scripts/mailowner
+++ b/scripts/mailowner
@@ -29,22 +29,26 @@ import sys
import paths
from Mailman import MailList
from Mailman import Message
-from Mailman.Logging.StampedLogger import StampedLogger
+from Mailman.Handlers import HandlerAPI
+from Mailman.Logging.Utils import LogStdErr
-try:
- sys.stderr = StampedLogger("error", label = 'post',
- manual_reprime=1, nofail=0)
-except IOError:
- pass # Oh well - SOL on redirect, errors show thru.
+LogStdErr('error', 'post')
-# Only let one program per list run at any one time. TBD: This *can* fail,
-# and should send back an error message when it does.
-mlist = MailList.MailList(sys.argv[1])
-try:
- msg = Message.Message(sys.stdin)
- if not mlist.bounce_processing or not mlist.ScanMessage(msg):
- mlist.DeliverToOwner(msg, mlist.owner)
-# Let another process run.
-finally:
- mlist.Unlock()
+
+def main():
+ # Only let one program per list run at any one time. TBD: This *can*
+ # fail, and should send back an error message when it does.
+ mlist = MailList.MailList(sys.argv[1])
+ try:
+ msg = Message.Message(sys.stdin)
+ if not mlist.bounce_processing or not mlist.ScanMessage(msg):
+ msg.recips = mlist.owner
+ HandlerAPI.DeliverToUser(mlist, msg)
+ finally:
+ mlist.Save()
+ mlist.Unlock()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/scripts/owner b/scripts/owner
index e53c71201..0e90d8562 100755
--- a/scripts/owner
+++ b/scripts/owner
@@ -29,22 +29,26 @@ import sys
import paths
from Mailman import MailList
from Mailman import Message
-from Mailman.Logging.StampedLogger import StampedLogger
+from Mailman.Handlers import HandlerAPI
+from Mailman.Logging.Utils import LogStdErr
-try:
- sys.stderr = StampedLogger("error", label = 'post',
- manual_reprime=1, nofail=0)
-except IOError:
- pass # Oh well - SOL on redirect, errors show thru.
+LogStdErr('error', 'post')
-# Only let one program per list run at any one time. TBD: This *can* fail,
-# and should send back an error message when it does.
-mlist = MailList.MailList(sys.argv[1])
-try:
- msg = Message.Message(sys.stdin)
- if not mlist.bounce_processing or not mlist.ScanMessage(msg):
- mlist.DeliverToOwner(msg, mlist.owner)
-# Let another process run.
-finally:
- mlist.Unlock()
+
+def main():
+ # Only let one program per list run at any one time. TBD: This *can*
+ # fail, and should send back an error message when it does.
+ mlist = MailList.MailList(sys.argv[1])
+ try:
+ msg = Message.Message(sys.stdin)
+ if not mlist.bounce_processing or not mlist.ScanMessage(msg):
+ msg.recips = mlist.owner
+ HandlerAPI.DeliverToUser(mlist, msg)
+ finally:
+ mlist.Save()
+ mlist.Unlock()
+
+
+if __name__ == '__main__':
+ main()