labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1606555 - in /labs/panopticon: pan-ezmlm/src/asf/wsgi/ezmlm.py pan-utils/src/asf/utils/ezmlm.py
Date Sun, 29 Jun 2014 18:18:04 GMT
Author: adc
Date: Sun Jun 29 18:18:04 2014
New Revision: 1606555

URL: http://svn.apache.org/r1606555
Log:
Explicitly configure command path

Modified:
    labs/panopticon/pan-ezmlm/src/asf/wsgi/ezmlm.py
    labs/panopticon/pan-utils/src/asf/utils/ezmlm.py

Modified: labs/panopticon/pan-ezmlm/src/asf/wsgi/ezmlm.py
URL: http://svn.apache.org/viewvc/labs/panopticon/pan-ezmlm/src/asf/wsgi/ezmlm.py?rev=1606555&r1=1606554&r2=1606555&view=diff
==============================================================================
--- labs/panopticon/pan-ezmlm/src/asf/wsgi/ezmlm.py (original)
+++ labs/panopticon/pan-ezmlm/src/asf/wsgi/ezmlm.py Sun Jun 29 18:18:04 2014
@@ -249,7 +249,7 @@ def asf_list_archives(mailing_list):
     if not os.path.exists(list_path):
         flask.abort(500)
 
-    ezmlm = Ezmlm(list_path)
+    ezmlm = Ezmlm(list_path, app.config['COMMAND_LOCATION'])
 
     etag = hashlib.sha1(str(ezmlm.num_messages)).hexdigest()
 
@@ -276,7 +276,7 @@ def asf_get_archives(mailing_list, messa
     if not os.path.exists(list_path):
         flask.abort(500)
 
-    ezmlm = Ezmlm(list_path)
+    ezmlm = Ezmlm(list_path, app.config['COMMAND_LOCATION'])
 
     message_path = ezmlm.path_to_archived_message(message_id)
     if not os.path.exists(message_path):
@@ -322,7 +322,7 @@ def ezmlm_list_groups(list_root_path):
 
 
 def ezmlm_list_subscribers(list_path):
-    ezmlm = Ezmlm(list_path)
+    ezmlm = Ezmlm(list_path, app.config['COMMAND_LOCATION'])
 
     subscribers = []
     for subscriber in sorted(ezmlm.subscribers):
@@ -332,7 +332,7 @@ def ezmlm_list_subscribers(list_path):
 
 
 def ezmlm_list_moderators(list_path):
-    ezmlm = Ezmlm(list_path)
+    ezmlm = Ezmlm(list_path, app.config['COMMAND_LOCATION'])
 
     moderators = []
     for moderator in sorted(ezmlm.moderators):
@@ -342,7 +342,7 @@ def ezmlm_list_moderators(list_path):
 
 
 def ezmlm_add_subscriber(list_path, subscriber):
-    ezmlm = Ezmlm(list_path)
+    ezmlm = Ezmlm(list_path, app.config['COMMAND_LOCATION'])
 
     ezmlm.add_subscriber(subscriber)
 
@@ -350,7 +350,7 @@ def ezmlm_add_subscriber(list_path, subs
 
 
 def ezmlm_add_moderator(list_path, moderator):
-    ezmlm = Ezmlm(list_path)
+    ezmlm = Ezmlm(list_path, app.config['COMMAND_LOCATION'])
 
     ezmlm.add_moderator(moderator)
 
@@ -358,7 +358,7 @@ def ezmlm_add_moderator(list_path, moder
 
 
 def ezmlm_remove_subscriber(list_path, subscriber):
-    ezmlm = Ezmlm(list_path)
+    ezmlm = Ezmlm(list_path, app.config['COMMAND_LOCATION'])
 
     ezmlm.remove_subscriber(subscriber)
 
@@ -366,7 +366,7 @@ def ezmlm_remove_subscriber(list_path, s
 
 
 def ezmlm_remove_moderator(list_path, moderator):
-    ezmlm = Ezmlm(list_path)
+    ezmlm = Ezmlm(list_path, app.config['COMMAND_LOCATION'])
 
     ezmlm.remove_moderator(moderator)
 

Modified: labs/panopticon/pan-utils/src/asf/utils/ezmlm.py
URL: http://svn.apache.org/viewvc/labs/panopticon/pan-utils/src/asf/utils/ezmlm.py?rev=1606555&r1=1606554&r2=1606555&view=diff
==============================================================================
--- labs/panopticon/pan-utils/src/asf/utils/ezmlm.py (original)
+++ labs/panopticon/pan-utils/src/asf/utils/ezmlm.py Sun Jun 29 18:18:04 2014
@@ -28,8 +28,9 @@ log = logging.getLogger(__name__)
 
 
 class Ezmlm(object):
-    def __init__(self, list_dir):
+    def __init__(self, list_dir, command_location=None):
         self.list_dir = list_dir
+        self.command_location = command_location or ''
 
     @property
     def num_messages(self):
@@ -40,7 +41,7 @@ class Ezmlm(object):
 
     @property
     def subscribers(self):
-        stdout, stderr = execute('ezmlm-list %s' % self.list_dir)
+        stdout, _ = execute(os.path.join(self.command_location, 'ezmlm-list') + ' ' + self.list_dir)
 
         subscribers = set()
         for line in stdout:
@@ -50,7 +51,7 @@ class Ezmlm(object):
 
     @property
     def moderators(self):
-        stdout, stderr = execute('ezmlm-list %s mod' % self.list_dir)
+        stdout, _ = execute(os.path.join(self.command_location, 'ezmlm-list') + ' ' + self.list_dir
+ ' mod')
         moderators = set()
         for line in stdout:
             moderators.add(line.strip())
@@ -61,25 +62,25 @@ class Ezmlm(object):
         if subscriber in self.subscribers:
             log.warning('Subscriber %s already in list')
         else:
-            execute('ezmlm-sub %s %s' % (self.list_dir, subscriber))
+            execute(os.path.join(self.command_location, 'ezmlm-sub') + ' ' + self.list_dir
+ ' ' + subscriber)
 
     def remove_subscriber(self, subscriber):
         if subscriber not in self.subscribers:
             log.warning('Subscriber %s not in list')
         else:
-            execute('ezmlm-unsub %s %s' % (self.list_dir, subscriber))
+            execute(os.path.join(self.command_location, 'ezmlm-unsub') + ' ' + self.list_dir
+ ' ' + subscriber)
 
     def add_moderator(self, moderator):
         if moderator in self.moderators:
             log.warning('Subscriber %s already in list')
         else:
-            execute('ezmlm-sub %s mod %s' % (self.list_dir, moderator))
+            execute(os.path.join(self.command_location, 'ezmlm-sub') + ' ' + self.list_dir
+ ' mod ' + moderator)
 
     def remove_moderator(self, moderator):
         if moderator not in self.moderators:
             log.warning('Subscriber %s not in list')
         else:
-            execute('ezmlm-unsub %s mod %s' % (self.list_dir, moderator))
+            execute(os.path.join(self.command_location, 'ezmlm-unsub') + ' ' + self.list_dir
+ ' mod ' + moderator)
 
     def path_to_archived_message(self, number):
         m = str(number / 100)



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message