Put some space between the gallery and the rest of the page content
[mediagoblin.git] / mediagoblin / mg_globals.py
1 """
2 In some places, we need to access the database, public_store, queue_store
3 """
4
5 import gettext
6 import pkg_resources
7
8
9 #############################
10 # General mediagoblin globals
11 #############################
12
13 # mongokit.Connection
14 db_connection = None
15
16 # mongokit.Connection
17 database = None
18
19 # should be the same as the
20 public_store = None
21 queue_store = None
22
23 # Dump mail to stdout instead of sending it:
24 email_debug_mode = False
25
26 # Address for sending out mails
27 email_sender_address = None
28
29 # A WorkBenchManager
30 workbench_manager = None
31
32 # gettext
33 translations = gettext.find(
34 'mediagoblin',
35 pkg_resources.resource_filename(
36 'mediagoblin', 'translations'), ['en'])
37
38 # app and global config objects
39 app_config = None
40 global_config = None
41
42 # The actual app object
43 app = None
44
45
46 def setup_globals(**kwargs):
47 """
48 Sets up a bunch of globals in this module.
49
50 Takes the globals to setup as keyword arguments. If globals are
51 specified that aren't set as variables above, then throw an error.
52 """
53 from mediagoblin import mg_globals
54
55 for key, value in kwargs.iteritems():
56 if not hasattr(mg_globals, key):
57 raise AssertionError("Global %s not known" % key)
58 setattr(mg_globals, key, value)