dabo Commit
Revision 3317
Date: 2007-08-21 09:21:40 -0700 (Tue, 21 Aug 2007)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/3317
Changed:
U trunk/dabo/__init__.py
Log:
Added a couple of convenience methods: makeDaboDirectories() and quickStart().
These are for setting up a standard Dabo directory structure, along with a
'main.py' to be used as the startup script for an app.
Diff:
Modified: trunk/dabo/__init__.py
===================================================================
--- trunk/dabo/__init__.py 2007-08-20 22:05:17 UTC (rev 3316)
+++ trunk/dabo/__init__.py 2007-08-21 16:21:40 UTC (rev 3317)
@@ -100,6 +100,7 @@
Have fun in your exploration of Dabo.
"""
+import os
import sys
try:
import pysqlite2
@@ -160,3 +161,38 @@
import dabo.db
import dabo.biz
import dabo.ui
+
+
+# Method to create a standard Dabo directory structure layout
+def makeDaboDirectories(homedir=None):
+ """If homedir is passes, the directories will be created off of that
+ directory. Otherwise, it is assumed that they should be created
+ in the current directory location.
+ """
+ currLoc = os.getcwd()
+ if homedir is not None:
+ os.chdir(homedir)
+ for d in ("biz", "db", "ui", "resources", "reports"):
+ if not os.path.exists(d):
+ os.mkdir(d)
+ os.chdir(currLoc)
+
+
+def quickStart(homedir=None):
+ """This creates a bare-bones application in either the specified
+ directory, or the current one if none is specified.
+ """
+ currLoc = os.getcwd()
+ if homedir is not None:
+ os.chdir(homedir)
+ makeDaboDirectories()
+ open("main.py", "w").write("""#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import dabo
+
+app = dabo.dApp()
+app.start()
+""")
+ os.chmod("main.py", 0744)
+ os.chdir(currLoc)
+
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/dabo-dev/[EMAIL PROTECTED]