def delete_gig_completely(the_gig): """ fully delete a gig, its archive, comments, plans, and itself """ if the_gig: if the_gig.is_archived: gigarchive.delete_archive(the_gig.archive_id) if the_gig.comment_id: gigcomment.delete_comment(the_gig.comment_id) comment.delete_comments_for_gig_key(the_gig.key) plan.delete_plans_for_gig_key(the_gig.key) the_gig.key.delete()
def make_archive_for_gig_key(the_gig_key): """ makes an archive for a gig - files away all the plans, then delete them """ archive_id = gigarchive.make_archive_for_gig_key(the_gig_key) if archive_id: the_gig = the_gig_key.get() if the_gig.archive_id: gigarchive.delete_archive(the_gig.archive_id) the_gig.archive_id = archive_id the_gig.put()
def get(self): user = self.user if user is None: self.redirect(users.create_login_url(self.request.uri)) else: the_gig_key = self.request.get("gk", None) if the_gig_key is None: self.response.write('did not find gig!') else: the_gig = ndb.Key(urlsafe=the_gig_key).get() if the_gig.is_archived: gigarchive.delete_archive(the_gig.archive_id) if the_gig.comment_id: gigcomment.delete_comment(the_gig.comment_id) comment.delete_comments_for_gig_key(the_gig.key) plan.delete_plans_for_gig_key(the_gig.key) the_gig.key.delete() return self.redirect('/')