]> git.ipfire.org Git - ipfire.org.git/blobdiff - src/backend/base.py
Merge remote-tracking branch 'origin/new-design'
[ipfire.org.git] / src / backend / base.py
index 00497a298cfa6ce8c3e2d3909ff7e366415f59ad..7e86251aa86553c63a43cf7511bede17af930635 100644 (file)
@@ -8,12 +8,17 @@ import tempfile
 import tornado.httpclient
 
 from . import accounts
+from . import asterisk
+from . import analytics
 from . import blog
+from . import bugzilla
+from . import cache
 from . import campaigns
 from . import database
 from . import fireinfo
+from . import httpclient
 from . import iuse
-from . import memcached
+from . import lists
 from . import messages
 from . import mirrors
 from . import netboot
@@ -22,8 +27,7 @@ from . import ratelimit
 from . import releases
 from . import resolver
 from . import settings
-from . import talk
-from . import tweets
+from . import toots
 from . import util
 from . import wiki
 from . import zeiterfassung
@@ -39,6 +43,8 @@ templates_dir = %(data_dir)s/templates
 """)
 
 class Backend(object):
+       version = 0
+
        def __init__(self, configfile, debug=False):
                # Read configuration file.
                self.config = self.read_config(configfile)
@@ -50,24 +56,24 @@ class Backend(object):
                self.setup_database()
 
                # Create HTTPClient
-               self.http_client = tornado.httpclient.AsyncHTTPClient(
-                       defaults = {
-                               "User-Agent" : "IPFireWebApp",
-                       }
-               )
-               # Initialize settings first.
+               self.http_client = httpclient.HTTPClient(self)
+
+               # Initialize the cache
+               self.cache = cache.Cache(self)
+
+               # Initialize settings first
                self.settings = settings.Settings(self)
-               self.memcache = memcached.Memcached(self)
 
                # Initialize backend modules.
                self.accounts = accounts.Accounts(self)
+               self.analytics = analytics.Analytics(self)
+               self.bugzilla = bugzilla.Bugzilla(self)
                self.fireinfo = fireinfo.Fireinfo(self)
                self.iuse = iuse.IUse(self)
                self.mirrors = mirrors.Mirrors(self)
                self.netboot = netboot.NetBoot(self)
                self.nopaste = nopaste.Nopaste(self)
                self.releases = releases.Releases(self)
-               self.talk = talk.Talk(self)
 
                self.blog = blog.Blog(self)
                self.wiki = wiki.Wiki(self)
@@ -95,7 +101,7 @@ class Backend(object):
                        "password" : self.config.get("database", "password"),
                }
 
-               self.db = database.Connection(**credentials)
+               self.db = database.Connection(self, **credentials)
 
        @lazy_property
        def ssl_context(self):
@@ -132,9 +138,9 @@ class Backend(object):
 
        async def run_task(self, task, *args, **kwargs):
                tasks = {
+                       "accounts:delete"     : self.accounts._delete,
                        "announce-blog-posts" : self.blog.announce,
                        "check-mirrors"       : self.mirrors.check_all,
-                       "check-spam"          : self.accounts.check_spam,
                        "cleanup"             : self.cleanup,
                        "get-all-emails"      : self.accounts.get_all_emails,
                        "launch-campaigns"    : self.campaigns.launch_manually,
@@ -144,7 +150,7 @@ class Backend(object):
                        "send-message"        : self.messages.send_cli,
                        "send-all-messages"   : self.messages.queue.send_all,
                        "test-ldap"           : self.accounts.test_ldap,
-                       "tweet"               : self.tweets.tweet,
+                       "toot"                : self.toots.toot,
                        "update-blog-feeds"   : self.blog.update_feeds,
                }
 
@@ -161,6 +167,10 @@ class Backend(object):
                if r:
                        raise SystemExit(r)
 
+       @lazy_property
+       def asterisk(self):
+               return asterisk.Asterisk(self)
+
        @lazy_property
        def campaigns(self):
                return campaigns.Campaigns(self)
@@ -169,6 +179,10 @@ class Backend(object):
        def groups(self):
                return accounts.Groups(self)
 
+       @lazy_property
+       def lists(self):
+               return lists.Lists(self)
+
        @lazy_property
        def messages(self):
                return messages.Messages(self)
@@ -192,8 +206,8 @@ class Backend(object):
                return resolver.Resolver(tries=2, timeout=2, domains=[])
 
        @lazy_property
-       def tweets(self):
-               return tweets.Tweets(self)
+       def toots(self):
+               return toots.Toots(self)
 
        async def cleanup(self):
                # Cleanup message queue