~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to services/usrmgt-server

  • Committer: Matt Giuca
  • Date: 2009-04-28 11:19:03 UTC
  • Revision ID: matt.giuca@gmail.com-20090428111903-murkoqeljahrp2d8
usrmgt-server: Removed all references to ivle.conf. Now uses the config
    object.
    (I created a global variable, config, just for the outermost functions to
    use. All of the other functions still use an argument version of config,
    for testing purposes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
import logging
6
6
 
7
7
import ivle.config
8
 
import ivle.conf
9
8
import ivle.database
10
9
import ivle.chat
11
10
import ivle.makeuser
12
11
 
 
12
config = ivle.config.Config()
 
13
 
13
14
# usage:
14
15
#   usrmgt-server <port> <magic>
15
16
 
48
49
    user = ivle.database.User.get_by_login(store, login)
49
50
 
50
51
    # make svn config/auth
51
 
    repopath = os.path.join(ivle.conf.svn_repo_path, 'users', login)
 
52
    repopath = os.path.join(config['paths']['svn']['repo_path'],
 
53
                            'users', login)
52
54
    logging.debug("Creating user's Subversion repository")
53
55
    ivle.makeuser.make_svn_repo(repopath, throw_on_error=True)
54
56
 
107
109
    groupnm = props['groupnm']
108
110
 
109
111
    namespace = "_".join([subj_short_name, year, semester, groupnm])
110
 
    repopath = os.path.join(ivle.conf.svn_repo_path, 'groups', namespace)
 
112
    repopath = os.path.join(config['paths']['svn']['repo_path'],
 
113
                            'groups', namespace)
111
114
    logging.debug("Creating Subversion repository %s"%repopath)
112
115
    try:
113
116
        ivle.makeuser.make_svn_repo(repopath)
128
131
def initializer():
129
132
    logging.basicConfig(filename="/var/log/usrmgt.log", level=logging.INFO)
130
133
    logging.info("Starting usrmgt server on port %d (pid = %d)" %
131
 
                 (ivle.conf.usrmgt_port, pid))
 
134
                 (config['usrmgt']['port'], pid))
132
135
 
133
136
    try:
134
137
        pidfile = open('/var/run/usrmgt-server.pid', 'w')
141
144
def dispatch(props):
142
145
    logging.debug(repr(props))
143
146
 
144
 
    config = ivle.config.Config()
145
147
    store = ivle.database.get_store(config)
146
148
    action = props.keys()[0]
147
149
    res = actions[action](store, props[action], config)
156
158
if __name__ == "__main__":
157
159
    pid = os.getpid()
158
160
 
159
 
    ivle.chat.start_server(ivle.conf.usrmgt_port, ivle.conf.usrmgt_magic,
 
161
    ivle.chat.start_server(config['usrmgt']['port'],config['usrmgt']['magic'],
160
162
                           True, dispatch, initializer)