annotate templates/classic/detectors/__init__.py @ 2497:e27578fc4e37

export now stores file "content" in separate files in export directory
author Richard Jones <richard@users.sourceforge.net>
date Thu, 24 Jun 2004 07:05:04 +0000
parents 461d8aa81376
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1591
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
1 #
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
2 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
3 # This module is free software, and you may redistribute it and/or modify
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
4 # under the same terms as Python, so long as this copyright message and
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
5 # disclaimer are retained in their original form.
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
6 #
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
7 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
8 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
9 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
10 # POSSIBILITY OF SUCH DAMAGE.
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
11 #
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
12 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
17 #
1835
461d8aa81376 merge from maint branch
Richard Jones <richard@users.sourceforge.net>
parents: 1786
diff changeset
18 #$Id: __init__.py,v 1.4 2003-10-07 06:18:45 richard Exp $
1591
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
19
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
20 import sys, os, imp
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
21
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
22 def init(db):
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
23 ''' execute the init functions of all the modules in this directory
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
24 '''
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
25 this_dir = os.path.split(__file__)[0]
1786
7752267776cc fixed file leak in detector initialisation (patch [SF#800715])
Richard Jones <richard@users.sourceforge.net>
parents: 1784
diff changeset
26 for filename in os.listdir(this_dir):
7752267776cc fixed file leak in detector initialisation (patch [SF#800715])
Richard Jones <richard@users.sourceforge.net>
parents: 1784
diff changeset
27 name, ext = os.path.splitext(filename)
1591
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
28 if name == '__init__':
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
29 continue
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
30 if ext == '.py':
1786
7752267776cc fixed file leak in detector initialisation (patch [SF#800715])
Richard Jones <richard@users.sourceforge.net>
parents: 1784
diff changeset
31 path = os.path.abspath(os.path.join(this_dir, filename))
7752267776cc fixed file leak in detector initialisation (patch [SF#800715])
Richard Jones <richard@users.sourceforge.net>
parents: 1784
diff changeset
32 fp = open(path)
7752267776cc fixed file leak in detector initialisation (patch [SF#800715])
Richard Jones <richard@users.sourceforge.net>
parents: 1784
diff changeset
33 try:
1835
461d8aa81376 merge from maint branch
Richard Jones <richard@users.sourceforge.net>
parents: 1786
diff changeset
34 module = imp.load_module(name, fp, path,
1786
7752267776cc fixed file leak in detector initialisation (patch [SF#800715])
Richard Jones <richard@users.sourceforge.net>
parents: 1784
diff changeset
35 ('.py', 'r', imp.PY_SOURCE))
7752267776cc fixed file leak in detector initialisation (patch [SF#800715])
Richard Jones <richard@users.sourceforge.net>
parents: 1784
diff changeset
36 finally:
7752267776cc fixed file leak in detector initialisation (patch [SF#800715])
Richard Jones <richard@users.sourceforge.net>
parents: 1784
diff changeset
37 fp.close()
1591
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
38 module.init(db)
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
39
21312a7564fd moving templates around
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
40 # vim: set filetype=python ts=4 sw=4 et si

Roundup Issue Tracker: http://roundup-tracker.org/