~vomun-developers/anonplus/vomun-trunk

« back to all changes in this revision

Viewing changes to src/libs/morado/functions.py

  • Committer: AJ00200
  • Date: 2011-11-26 00:03:57 UTC
  • Revision ID: git-v1:f4f4352eb338a5f57a5a92e4bf23bec36d298d13
Blocks we receive are now stored in ~/.vomun/blocks.json. libs.globals and libs.config are now used directly after importing libs; they are set in libs/__init__.py now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
 
import libs.globals
 
2
import libs
3
3
import libs.threadmanager
4
4
 
5
 
libs.globals.global_vars["apifunctions"] = {}
 
5
libs.globals['apifunctions'] = {}
6
6
 
7
7
def register_with_api(func):
8
 
    libs.globals.global_vars["apifunctions"][func.__name__] = func
 
8
    libs.globals['apifunctions'][func.__name__] = func
9
9
    return func
10
10
 
11
11
@register_with_api
12
12
def get_functions():
13
13
    '''lists the api functions'''
14
 
    return [func.__name__ for func in libs.globals.global_vars['apifunctions'].values()]
 
14
    return [func.__name__ for func in libs.globals['apifunctions'].values()]
15
15
 
16
16
@register_with_api
17
17
def help(funcname):
21
21
            func = f
22
22
            break
23
23
    return func.__doc__
24
 
     
 
24
 
25
25
@register_with_api
26
26
def shutdown():
27
27
    '''shuts down the server'''
33
33
@register_with_api
34
34
def get_build():
35
35
    '''Return the build number'''
36
 
    return libs.globals.global_vars['anon+']['BUILD']
 
36
    return libs.globals['anon+']['BUILD']
 
37
 
 
38
# Functions for the config file
 
39
@register_with_api
 
40
def reload_config():
 
41
    '''Reload the configuration file.'''
 
42
    libs.config.load()
 
43
 
 
44
@register_with_api
 
45
def get_config():
 
46
    '''Return the contents of the configuration file.'''
 
47
    return libs.config
 
48
 
 
49
@register_with_api
 
50
def save_config():
 
51
    '''Save the contents of the configuration file.'''
 
52
    libs.config.save()