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: instance.py,v 1.3 2001-08-07 00:24:42 richard Exp $
20 ''' Currently this module provides one function: open. This function opens
21 an instance.
22 '''
24 import imp
26 class Opener:
27 def __init__(self):
28 self.number = 0
29 self.instances = {}
31 def open(self, instance_home):
32 if self.instances.has_key(instance_home):
33 return imp.load_package(self.instances[instance_home],
34 instance_home)
35 self.number = self.number + 1
36 modname = '_roundup_instance_%s'%self.number
37 self.instances[instance_home] = modname
38 return imp.load_package(modname, instance_home)
40 opener = Opener()
41 open = opener.open
43 del Opener
44 del opener
47 #
48 # $Log: not supported by cvs2svn $
49 # Revision 1.2 2001/08/07 00:15:51 richard
50 # Added the copyright/license notice to (nearly) all files at request of
51 # Bizar Software.
52 #
53 # Revision 1.1 2001/08/05 07:43:52 richard
54 # Instances are now opened by a special function that generates a unique
55 # module name for the instances on import time.
56 #
57 #
58 #
59 # vim: set filetype=python ts=4 sw=4 et si