1 #
2 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
3 # This module is free software, and you may redistribute it and/or modify
4 # under the same terms as Python, so long as this copyright message and
5 # disclaimer are retained in their original form.
6 #
7 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
8 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
9 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
10 # POSSIBILITY OF SUCH DAMAGE.
11 #
12 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 #
18 #$Id: __init__.py,v 1.4 2003-10-07 06:18:45 richard Exp $
20 import sys, os, imp
22 def init(db):
23 ''' execute the init functions of all the modules in this directory
24 '''
25 this_dir = os.path.split(__file__)[0]
26 for filename in os.listdir(this_dir):
27 name, ext = os.path.splitext(filename)
28 if name == '__init__':
29 continue
30 if ext == '.py':
31 path = os.path.abspath(os.path.join(this_dir, filename))
32 fp = open(path)
33 try:
34 module = imp.load_module(name, fp, path,
35 ('.py', 'r', imp.PY_SOURCE))
36 finally:
37 fp.close()
38 module.init(db)
40 # vim: set filetype=python ts=4 sw=4 et si