605
605
db = common.db.DB()
606
dbquery = db.return_insert(
608
'projectsetid': projectsetid,
609
'synopsis': synopsis,
611
'deadline': deadline,
614
frozenset(["projectsetid", "synopsis", "url", "deadline"]), # fields
615
["projectid"], # returns
607
dbquery = db.return_insert(
609
'projectsetid': projectsetid,
610
'synopsis': synopsis,
612
'deadline': deadline,
615
frozenset(["projectsetid", "synopsis", "url", "deadline"]),
616
["projectid"], # returns
619
req.throw_error(req.HTTP_INTERNAL_SERVER_ERROR, repr(e))
619
623
response = cjson.encode(dbquery.dictresult()[0])
671
678
"epoch"]), # fields
672
679
["groupid"], # returns
674
except pg.ProgrammingError, e:
675
req.throw_error(req.HTTP_FORBIDDEN, repr(e))
677
singlerow = dbquery.dictresult()[0]
678
groupid = singlerow['groupid']
682
singlerow = dbquery.dictresult()[0]
683
groupid = singlerow['groupid']
680
# Create the groups repository
681
# Get the arguments for usermgt.activate_user from the session
682
# (The user must have already logged in to use this app)
685
# Create the groups repository
686
# Get the arguments for usermgt.activate_user from the session
687
# (The user must have already logged in to use this app)
684
# Find the rest of the parameters we need
689
# Find the rest of the parameters we need
686
690
offeringinfo = db.get_offering_info(projectsetid)
687
except pg.ProgrammingError, e:
692
subj_short_name = offeringinfo['subj_short_name']
693
year = offeringinfo['year']
694
semester = offeringinfo['semester']
697
"subj_short_name": subj_short_name,
699
"semester": semester,
702
msg = {'create_group_repository': args}
704
# Contact the usrmgt server
706
usrmgt = chat.chat(usrmgt_host, usrmgt_port, msg, usrmgt_magic)
707
except cjson.DecodeError, e:
708
req.throw_error(req.HTTP_INTERNAL_SERVER_ERROR,
709
"Could not understand usrmgt server response: %s"%e.message)
711
if 'response' not in usrmgt or usrmgt['response']=='failure':
712
req.throw_error(req.HTTP_INTERNAL_SERVER_ERROR,
713
"Failure creating repository: %s"%str(usrmgt))
715
# Everything went OK. Lock it in
688
720
req.throw_error(req.HTTP_INTERNAL_SERVER_ERROR, repr(e))
691
subj_short_name = offeringinfo['subj_short_name']
692
year = offeringinfo['year']
693
semester = offeringinfo['semester']
696
"subj_short_name": subj_short_name,
698
"semester": semester,
701
msg = {'create_group_repository': args}
703
# Contact the usrmgt server
705
usrmgt = chat.chat(usrmgt_host, usrmgt_port, msg, usrmgt_magic)
706
except cjson.DecodeError, e:
707
req.throw_error(req.HTTP_INTERNAL_SERVER_ERROR,
708
"Could not understand usrmgt server response: %s"%e.message)
710
if 'response' not in usrmgt or usrmgt['response']=='failure':
711
req.throw_error(req.HTTP_INTERNAL_SERVER_ERROR,
712
"Failure creating repository: %s"%str(usrmgt))
714
724
response = cjson.encode(singlerow)
796
808
"group_member", # table
797
809
frozenset(["loginid", "groupid"]), # fields
799
except pg.ProgrammingError, e:
800
req.throw_error(req.HTTP_FORBIDDEN, repr(e))
802
# Rebuild the svn config file
803
# Contact the usrmgt server
804
msg = {'rebuild_svn_group_config': {}}
806
usrmgt = chat.chat(usrmgt_host, usrmgt_port, msg, usrmgt_magic)
807
except cjson.DecodeError, e:
808
req.throw_error(req.HTTP_INTERNAL_SERVER_ERROR,
809
"Could not understand usrmgt server response: %s"%e.message)
811
if 'response' not in usrmgt or usrmgt['response']=='failure':
812
req.throw_error(req.HTTP_INTERNAL_SERVER_ERROR,
813
"Failure creating repository: %s"%str(usrmgt))
812
# Rebuild the svn config file
813
# Contact the usrmgt server
814
msg = {'rebuild_svn_group_config': {}}
816
usrmgt = chat.chat(usrmgt_host, usrmgt_port, msg, usrmgt_magic)
817
except cjson.DecodeError, e:
818
req.throw_error(req.HTTP_INTERNAL_SERVER_ERROR,
819
"Could not understand usrmgt server response: %s"%e.message)
821
if 'response' not in usrmgt or usrmgt['response']=='failure':
822
req.throw_error(req.HTTP_INTERNAL_SERVER_ERROR,
823
"Failure creating repository: %s"%str(usrmgt))
825
# Everything went OK. Lock it into the database
830
req.throw_error(req.HTTP_INTERNAL_SERVER_ERROR, repr(e))
815
834
return(cjson.encode({'response': 'okay'}))