Commit ee6164a2 authored by Jim Fulton's avatar Jim Fulton

Added logic to set up gadfly area on first use.

parent f88c1972
'''$Id: db.py,v 1.1 1998/04/15 15:10:41 jim Exp $''' '''$Id: db.py,v 1.2 1998/05/21 15:33:56 jim Exp $'''
# Copyright # Copyright
# #
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne # Copyright 1996 Digital Creations, L.C., 910 Princess Anne
# Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All # Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
# rights reserved. # rights reserved.
# #
__version__='$Revision: 1.1 $'[11:-2] __version__='$Revision: 1.2 $'[11:-2]
import string, sys, os import string, sys, os
from string import strip, split, find, join from string import strip, split, find, join
...@@ -16,6 +16,26 @@ import Globals ...@@ -16,6 +16,26 @@ import Globals
data_dir=os.path.join(Globals.data_dir,'gadfly') data_dir=os.path.join(Globals.data_dir,'gadfly')
def manage_DataSources(): def manage_DataSources():
if not os.path.exists(data_dir):
try:
os.mkdir(data_dir)
os.mkdir(os.path.join(data_dir,'demo'))
except:
raise 'Gadfly Error', (
"""
The Aqueduct Gadfly Database Adapter requires the
existence of the directory, <code>%s</code>. An error
occurred while trying to create this directory.
""" % data_dir)
if not os.path.isdir(data_dir):
raise 'Gadfly Error', (
"""
The Aqueduct Gadfly Database Adapter requires the
existence of the directory, <code>%s</code>. This
exists, but is not a directory.
""" % data_dir)
return map( return map(
lambda d: (d,''), lambda d: (d,''),
filter(lambda f, i=os.path.isdir, d=data_dir, j=os.path.join: filter(lambda f, i=os.path.isdir, d=data_dir, j=os.path.join:
...@@ -150,6 +170,9 @@ Defs={maybe_int: 'i', maybe_float:'n', maybe_string:'s', must_be_text:'t'} ...@@ -150,6 +170,9 @@ Defs={maybe_int: 'i', maybe_float:'n', maybe_string:'s', must_be_text:'t'}
########################################################################## ##########################################################################
# #
# $Log: db.py,v $ # $Log: db.py,v $
# Revision 1.2 1998/05/21 15:33:56 jim
# Added logic to set up gadfly area on first use.
#
# Revision 1.1 1998/04/15 15:10:41 jim # Revision 1.1 1998/04/15 15:10:41 jim
# initial # initial
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment