@@ -53,7 +53,7 @@ def display_major_project(user_dict=None):
5353 "time_spent" : p .time_spent ,
5454 "skills" : p .skills ,
5555 "desc" : p .description ,
56- "links" : list (filter (None , p .links .split ("\n " ))),
56+ "links" : [] if p . links is None else list (filter (None , p .links .split ("\n " ))),
5757 "status" : p .status ,
5858 "is_owner" : bool (user_dict ["username" ] == p .uid ),
5959 "files" : list_files_in_folder (bucket , f"{ p .id } /" )
@@ -65,6 +65,7 @@ def display_major_project(user_dict=None):
6565 return render_template (
6666 "major_project_submission.html" ,
6767 major_projects = major_projects ,
68+ bucket_name = bucket ,
6869 major_projects_len = len (major_projects ),
6970 username = user_dict ["username" ])
7071
@@ -156,7 +157,9 @@ def submit_major_project(user_dict=None):
156157 for file in os .listdir (temp_dir ):
157158 filepath = f"{ temp_dir } /{ file } "
158159
159- s3 .upload_file (filepath , 'major-project-media' , f"{ project .id } /{ file } " )
160+ s3 .upload_file (filepath , app .config ['S3_BUCKET_ID' ], f"{ project .id } /{ file } " , ExtraArgs = {
161+ 'ExpectedBucketOwner' : app .config ['S3_BUCKET_ID' ]
162+ })
160163
161164 os .remove (filepath )
162165
@@ -165,12 +168,16 @@ def submit_major_project(user_dict=None):
165168
166169
167170 # Send the slack ping only after we know that the data was properly saved to the DB
168- send_slack_ping (
169- {
170- "text" : f"<!subteam^S5XENJJAH> *{ get_member_name (user_id )} * ({ user_id } )"
171- f" submitted their major project, *{ name } *!"
172- }
173- )
171+ if app .config ['DEV_DISABLE_SLACK_PING' ]:
172+ log .info ("Slack ping skipped due to environment override" )
173+ else :
174+ send_slack_ping (
175+ {
176+ "text" : f"<!subteam^S5XENJJAH> *{ get_member_name (user_id )} * ({ user_id } )"
177+ f" submitted their major project, *{ name } *!"
178+ }
179+ )
180+
174181
175182 return jsonify ({"success" : True }), 200
176183
@@ -181,7 +188,7 @@ def submit_major_project(user_dict=None):
181188def major_project_review (user_dict = None ):
182189 log = logger .new (request = request , auth_dict = user_dict )
183190
184- if not user_dict_is_eval_director (user_dict [ "account" ] ):
191+ if not user_dict_is_eval_director (user_dict ):
185192 return redirect ("/dashboard" , code = 302 )
186193
187194 post_data = request .get_json ()
@@ -190,7 +197,6 @@ def major_project_review(user_dict=None):
190197
191198 log .info (f"{ status } Major Project ID: { pid } " )
192199
193- print (post_data )
194200 MajorProject .query .filter (MajorProject .id == pid ).update ({"status" : status })
195201
196202 db .session .flush ()
0 commit comments