]> git.ipfire.org Git - ipfire.org.git/blame - webapp/backend/misc.py
planet: Make the publish radio button work.
[ipfire.org.git] / webapp / backend / misc.py
CommitLineData
940227cb
MT
1#!/usr/bin/python
2
a6dc0bad
MT
3class Object(object):
4 def __init__(self, backend):
5 self.backend = backend
6
7 @property
8 def db(self):
9 return self.backend.db
10
11 @property
12 def accounts(self):
13 return self.backend.accounts
14
15 @property
16 def planet(self):
17 return self.backend.planet
18
19
940227cb
MT
20class Singleton(type):
21 """
22 A class for using the singleton pattern
23 """
24
25 def __init__(cls, name, bases, dict):
26 super(Singleton, cls).__init__(name, bases, dict)
27 cls.instance = None
28
29 def __call__(cls, *args, **kw):
30 if cls.instance is None:
31 cls.instance = super(Singleton, cls).__call__(*args, **kw)
32
33 return cls.instance