PageRenderTime 289ms CodeModel.GetById 120ms app.highlight 2ms RepoModel.GetById 126ms app.codeStats 0ms

/python/engine/__init__.py

http://scim-python.googlecode.com/
Python | 50 lines | 20 code | 5 blank | 25 comment | 7 complexity | f4cef05e18fef36a1714df3a80d8b61f MD5 | raw file
 1# -*- coding: utf-8 -*-
 2# vim:set noet ts=4:
 3#
 4# scim-python
 5#
 6# Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
 7#
 8#
 9# This library is free software; you can redistribute it and/or
10# modify it under the terms of the GNU Lesser General Public
11# License as published by the Free Software Foundation; either
12# version 2 of the License, or (at your option) any later version.
13#
14# This library is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17# GNU Lesser General Public License for more details.
18#
19# You should have received a copy of the GNU Lesser General Public
20# License along with this program; if not, write to the
21# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22# Boston, MA  02111-1307  USA
23#
24# $Id: $
25#
26import scim
27from glob import glob
28from os import path
29factorys = None
30
31def query_engines (config):
32	global factorys
33	if factorys != None:
34		return factorys
35
36	factorys = []
37
38	wildcast = path.join (path.dirname (__file__), "*")
39
40	for name in [name for name in glob (wildcast) if path.isdir (name)]:
41		try:
42			name = path.basename (name)
43			mod = __import__ (name, globals(), locals(), [])
44			factorys = factorys + mod.get_factorys (config)
45		except Exception, e:
46			print e
47	return factorys
48
49if __name__ == "__main__":
50	print query_engines (None);