[mhonarc] add symlink to public archive if needed



commit ea7f8d565df36fc4336673b70c8fefa0a2df7139
Author: Olav Vitters <olav vitters nl>
Date:   Tue Feb 12 23:06:03 2013 +0100

    add symlink to public archive if needed

 archive.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/archive.py b/archive.py
index 87decec..ada54fe 100755
--- a/archive.py
+++ b/archive.py
@@ -205,7 +205,12 @@ class Archiver:
     def make_index(cls, listname, private=False):
         path = os.path.join(cls.PRIVATE_ARCHIVE_DIR, listname)
 
-        # XXX - if public add symlink from private to public
+        # If public add symlink from private to public
+        if not private and not os.path.lexists(os.path.join(cls.PUBLIC_ARCHIVE_DIR, listname)):
+            if not os.path.exists(cls.PUBLIC_ARCHIVE_DIR):
+                os.makedirs(cls.PUBLIC_ARCHIVE_DIR, 0755)
+
+            os.symlink(os.path.join(cls.PRIVATE_ARCHIVE_DIR, listname), os.path.join(cls.PUBLIC_ARCHIVE_DIR, listname))
 
         dirs = {}
         re_path = re.compile(r'^(\d+)-(\w+)$')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]