Esempio n. 1
0
 def before_request():
     # Set the school as an application-wide variable
     g.school = load_school(app.config['SCHOOL'])
     g.all_schools = load_all_schools()
     g.default_school = load_school(app.config['DEFAULT_SCHOOL'])
     g.is_default_school = app.config['SCHOOL'] == app.config[
         'DEFAULT_SCHOOL']
Esempio n. 2
0
def remove_user(user, school):
    """ Removes a user from a school's committee """
    print "Loading DAN - committee for %s:" % school
    if school is None:
        school = current_app.config['DEFAULT_SCHOOL']
    s = load_school(school)
    u = find_user(user)
    if u:
        remove_user_from_dan(u, load_dan(s))
        print " - removed from committee: %s" % user
    else:
        print " - no user exists with email or username: %s" % user
Esempio n. 3
0
def add_user(user, school):
    """ Adds a user to a school's committee """
    print "Loading DAN - committee for %s:" % school
    if school is None:
        school = current_app.config['DEFAULT_SCHOOL']
    s = load_school(school)
    u = find_user(user)
    if u:
        add_user_to_dan(u, load_dan(s))
        print " - added to committee: %s" % user
    else:
        print " - no user exists with email or username: %s" % user
Esempio n. 4
0
def show(school):
    """ Shows details of a school's committee """
    if school is None:
        school = current_app.config['DEFAULT_SCHOOL']
    s = load_school(school)
    dan = load_dan(s)
    print "DAN - committee for %s:" % school
    if dan.users:
        for u in dan.users:
            print " - %s <%s>" % (u.username, u.email)
    else:
        print " - There is nobody on the committee now. Use 'add_user -u <user> -s <school>' to add someone."
def remove_user(user, school):
	""" Removes a user from a school's committee """
	print "Loading DAN - committee for %s:" % school
	if school is None:
		school = current_app.config['DEFAULT_SCHOOL']
	s = load_school(school)
	u = find_user(user)
	if u:
		remove_user_from_dan(u, load_dan(s))
		print " - removed from committee: %s" % user
	else:
		print " - no user exists with email or username: %s" % user
def add_user(user, school):
	""" Adds a user to a school's committee """
	print "Loading DAN - committee for %s:" % school
	if school is None:
		school = current_app.config['DEFAULT_SCHOOL']
	s = load_school(school)
	u = find_user(user)
	if u:
		add_user_to_dan(u, load_dan(s))
		print " - added to committee: %s" % user
	else:
		print " - no user exists with email or username: %s" % user
def show(school):
	""" Shows details of a school's committee """
	if school is None:
		school = current_app.config['DEFAULT_SCHOOL']
	s = load_school(school)
	dan = load_dan(s)
	print "DAN - committee for %s:" % school
	if dan.users:
		for u in dan.users:
			print " - %s <%s>" % (u.username, u.email)
	else:
		print " - There is nobody on the committee now. Use 'add_user -u <user> -s <school>' to add someone."
	def before_request():
		# Set the school as an application-wide variable
		g.school = load_school(app.config['SCHOOL'])
		g.all_schools = load_all_schools()
		g.default_school = load_school(app.config['DEFAULT_SCHOOL'])
		g.is_default_school = app.config['SCHOOL']==app.config['DEFAULT_SCHOOL']