]>
git.ipfire.org Git - ipfire.org.git/blob - webapp/backend/base.py
3 import ConfigParser
as configparser
21 from . import zeiterfassung
23 class Backend(object):
24 def __init__(self
, configfile
, debug
=False):
25 # Read configuration file.
26 self
.config
= self
.read_config(configfile
)
32 # Initialize settings first.
33 self
.settings
= settings
.Settings(self
)
34 self
.memcache
= memcached
.Memcached(self
)
36 # Initialize backend modules.
37 self
.accounts
= accounts
.Accounts(self
)
38 self
.advertisements
= ads
.Advertisements(self
)
39 self
.downloads
= mirrors
.Downloads(self
)
40 self
.geoip
= geoip
.GeoIP(self
)
41 self
.fireinfo
= fireinfo
.Fireinfo(self
)
42 self
.iuse
= iuse
.IUse(self
)
43 self
.mirrors
= mirrors
.Mirrors(self
)
44 self
.netboot
= netboot
.NetBoot(self
)
45 self
.nopaste
= nopaste
.Nopaste(self
)
46 self
.news
= news
.News(self
)
47 self
.planet
= planet
.Planet(self
)
48 self
.releases
= releases
.Releases(self
)
49 self
.talk
= talk
.Talk(self
)
51 self
.zeiterfassung
= zeiterfassung
.ZeiterfassungClient(self
)
53 def read_config(self
, configfile
):
54 cp
= configparser
.ConfigParser()
59 def setup_database(self
):
61 Sets up the database connection.
64 "host" : self
.config
.get("database", "server"),
65 "database" : self
.config
.get("database", "database"),
66 "user" : self
.config
.get("database", "username"),
67 "password" : self
.config
.get("database", "password"),
70 self
.db
= database
.Connection(**credentials
)