Commit | Line | Data |
---|---|---|
df9809c2 CAW |
1 | """ |
2 | In some places, we need to access the database, public_store, queue_store | |
3 | """ | |
4 | ||
b77eec65 CAW |
5 | import gettext |
6 | import pkg_resources | |
7 | ||
218b8124 | 8 | |
df9809c2 CAW |
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 | ||
49285baf E |
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 | ||
b77eec65 CAW |
32 | # gettext |
33 | translations = gettext.find( | |
34 | 'mediagoblin', | |
35 | pkg_resources.resource_filename( | |
36 | 'mediagoblin', 'translations'), ['en']) | |
37 | ||
218b8124 CAW |
38 | # app and global config objects |
39 | app_config = None | |
40 | global_config = None | |
41 | ||
42 | # The actual app object | |
43 | app = None | |
44 | ||
df9809c2 CAW |
45 | |
46 | def setup_globals(**kwargs): | |
68bf5b19 CAW |
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 | """ | |
6e7ce8d1 | 53 | from mediagoblin import mg_globals |
df9809c2 CAW |
54 | |
55 | for key, value in kwargs.iteritems(): | |
49285baf E |
56 | if not hasattr(mg_globals, key): |
57 | raise AssertionError("Global %s not known" % key) | |
df9809c2 | 58 | setattr(mg_globals, key, value) |