summaryrefslogtreecommitdiff
path: root/tools/dfagen/dfagen/output/__init__.py
blob: bbb8365a0bd91c47f95771db827af942484fb507 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from ConfigParser import ConfigParser

class UserConfig:
    def __init__ (self, file):
	if file:
	    f = open (file, 'r')
	    cp = ConfigParser ()
	    cp.readfp (f)
	    f.close ()
	    self.dict = dict (cp.items ('user'))
	    if cp.has_section ('templates'):
		self.templates = dict (cp.items ('templates'))
	    else:
		self.templates = dict ()

    def __getitem__ (self, key):
	return self.dict[key]

    def __contains__ (self, key):
	return key in self.dict

import c
import dot

outputs = dict (
	c = c,
	dot = dot,
	)

def get_output (name):
    return outputs[name];