[billreminder] Very rough draft of what will be the driver for starting the django based application.



commit 4db718cfb5b412c7c4dff7d45635b98aa4cea803
Author: Og B. Maciel <ogmaciel gnome org>
Date:   Thu Jul 23 13:35:10 2009 -0400

    Very rough draft of what will be the driver for starting the django based application.

 src/webreminder.py |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/src/webreminder.py b/src/webreminder.py
new file mode 100644
index 0000000..e6a4683
--- /dev/null
+++ b/src/webreminder.py
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+
+import os
+import shutil
+from lib.common import APPNAME
+from xdg.BaseDirectory import *
+
+def main():
+
+    # Configuration files
+    conf_dir = os.path.join(xdg_config_home, APPNAME.lower())
+    # If the configuration directory doesn't exist, then create it
+    # and copy all the "django" files to it.
+
+    # TODO: The location of where these files are is determined on the
+    # following: if the application is installed in the system, then get
+    # it from xdg_config_dirs, else get a copy from the checkout code.
+    if not os.path.isdir(conf_dir):
+        try:
+            configfiles = os.path.join(xdg_config_dirs, APPNAME.lower())
+            shutil.copytree(configfiles, conf_dir)
+        except Exception, e:
+            src = os.path.join(os.path.realpath(os.curdir), "manage.py")
+            dest = os.path.join(conf_dir, "manage.py")
+            os.mkdir(conf_dir)
+            shutil.copyfile(src, dest)
+
+    # Data storage
+    data_dir = os.path.join(xdg_data_home, APPNAME.lower())
+    # Create the directory if it doesn't exist
+    if not os.path.isdir(data_dir):
+        os.mkdir(data_dir)
+
+    # Are all the django files in place?
+
+if __name__ == "__main__":
+    main()



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