#!/usr/bin/python
-import ConfigParser as configparser
-import StringIO
-
-import accounts
-import database
-import geoip
-import fireinfo
-import iuse
-import memcached
-import mirrors
-import netboot
-import nopaste
-import releases
-import settings
-import talk
+import configparser
+import io
+import tornado.gen
+
+from . import accounts
+from . import database
+from . import geoip
+from . import fireinfo
+from . import iuse
+from . import mirrors
+from . import netboot
+from . import nopaste
+from . import releases
+from . import settings
+from . import talk
from . import blog
+from . import wiki
from . import zeiterfassung
-DEFAULT_CONFIG = StringIO.StringIO("""
+DEFAULT_CONFIG = io.StringIO("""
[global]
debug = false
# Initialize settings first.
self.settings = settings.Settings(self)
- self.memcache = memcached.Memcached(self)
# Initialize backend modules.
self.accounts = accounts.Accounts(self)
- self.downloads = mirrors.Downloads(self)
self.geoip = geoip.GeoIP(self)
self.fireinfo = fireinfo.Fireinfo(self)
self.iuse = iuse.IUse(self)
self.talk = talk.Talk(self)
self.blog = blog.Blog(self)
+ self.wiki = wiki.Wiki(self)
self.zeiterfassung = zeiterfassung.ZeiterfassungClient(self)
def read_config(self, configfile):
}
self.db = database.Connection(**credentials)
+
+ @tornado.gen.coroutine
+ def run_task(self, task, *args, **kwargs):
+ tasks = {
+ "update-blog-feeds" : self.blog.update_feeds,
+ }
+
+ # Get the task from the list of all tasks
+ func = tasks.get(task, None)
+ if not func:
+ raise ValueError("Unknown task: %s" % task)
+
+ # Run the task
+ r = yield func(*args, **kwargs)
+
+ # If any error code has been returned,
+ # we will end the program
+ if r:
+ raise SystemExit(r)