def delete(id): task_to_delete = db.query(Todo).get(id) db.delete(task_to_delete) db.commit() return redirect("/")
def handler(command, argument): current_job = db.get_state()['job'] if argument == current_job: return view.cannotDeleteCurrentJob(current_job) if db.exists(argument): db.delete(argument) return view.deleted(argument) view.notFound(argument)
def test_remove(self, cubmail): print "removing "+cubmail users = User.gql("WHERE cubmail = :1", cubmail) myclass = users.get() try: db.delete(myclass) except (Exception): print "can't find "+cubmail+"\n"
def test_remove(self, name): print "removing "+name subjects = Subject.gql("WHERE description = :1", name) subject = subjects.get() try: db.delete(subject) except (Exception): print "can't find "+name+"\n"
async def delete_step2(message: types.Message, state: FSMContext): birthday = db.query(Birthday).filter(Birthday.name == message.text).first() if birthday is None: await message.reply('No such name in the list') else: db.delete(birthday) db.commit() await state.finish()
def profile_delete(): session_token = request.cookies.get("session_token") user = db.query(User).filter_by(session_token=session_token).first() if request.method == "GET": if user: return render_template("profile_delete.html", user=user) else: return redirect(url_for("index")) elif request.method == "POST": db.delete(user) db.commit() return redirect(url_for("index"))
def delete_person(self, person): """Delete a person record and associated data. If it's an original record, deletion can be undone within EXPIRED_TTL_DAYS days.""" if person.is_original(): # For an original record, set the expiry date and send notifiations # to all the related e-mail addresses offering an undelete link. # (The externally visible result will be as if we overwrote the # record with an expiry date and blank fields.) # i18n: Subject line of an e-mail message notifying a user # i18n: that a person record has been deleted subject = _( '[Person Finder] Deletion notice for ' '"%(first_name)s %(last_name)s"' ) % {'first_name': person.first_name, 'last_name': person.last_name} # Send e-mail to all the addresses notifying them of the deletion. for email in person.get_associated_emails(): if email == person.author_email: template_name = 'deletion_email_for_person_author.txt' else: template_name = 'deletion_email_for_note_author.txt' self.send_mail( subject=subject, to=email, body=self.render_to_string( template_name, first_name=person.first_name, last_name=person.last_name, site_url=self.get_url('/'), days_until_deletion=EXPIRED_TTL_DAYS, restore_url=self.get_restore_url(person) ) ) # Set the expiry_date to now, and set is_expired flags to match. person.expiry_date = utils.get_utcnow() person.put_expiry_flags() else: # For a clone record, we don't have authority to change the # expiry_date, so we just delete the record now. (The externally # visible result will be as if we had never received a copy of it.) db.delete([person] + person.get_notes(filter_expired=False))
def delete_person(self, person): """Delete a person record and associated data. If it's an original record, deletion can be undone within EXPIRED_TTL_DAYS days.""" if person.is_original(): # For an original record, set the expiry date and send notifiations # to all the related e-mail addresses offering an undelete link. # (The externally visible result will be as if we overwrote the # record with an expiry date and blank fields.) # i18n: Subject line of an e-mail message notifying a user # i18n: that a person record has been deleted subject = _('[Person Finder] Deletion notice for ' '"%(first_name)s %(last_name)s"') % { 'first_name': person.first_name, 'last_name': person.last_name } # Send e-mail to all the addresses notifying them of the deletion. for email in person.get_associated_emails(): if email == person.author_email: template_name = 'deletion_email_for_person_author.txt' else: template_name = 'deletion_email_for_note_author.txt' self.send_mail(subject=subject, to=email, body=self.render_to_string( template_name, first_name=person.first_name, last_name=person.last_name, site_url=self.get_url('/'), days_until_deletion=EXPIRED_TTL_DAYS, restore_url=self.get_restore_url(person))) # Set the expiry_date to now, and set is_expired flags to match. person.expiry_date = utils.get_utcnow() person.put_expiry_flags() else: # For a clone record, we don't have authority to change the # expiry_date, so we just delete the record now. (The externally # visible result will be as if we had never received a copy of it.) db.delete([person] + person.get_notes(filter_expired=False))
def remove_all(self): query = User().all() for result in query: db.delete(result)
def remove_all(self): query = Subject().all() for result in query: db.delete(result)