def deleteUpcomingFeedingTime(dateToDate): try: con = commonTasks.connect_db() cur = con.execute("""delete from feedtimes where feeddate=?""", [str(dateToDate), ]) con.commit() cur.close() con.close() return 'ok' except Exception as e: return e
def deleteUpcomingFeedingTime(dateToDate): try: con = commonTasks.connect_db() cur = con.execute("""delete from feedtimes where feeddate=?""", [ str(dateToDate), ]) con.commit() cur.close() con.close() return 'ok' except Exception, e: return render_template('error.html', resultsSET=e)
def deleteUser(id): try: if 'userLogin' in session: con = commonTasks.connect_db() cur = con.execute("""delete from user where username=?""", [str(id), ]) con.commit() cur.close() con.close() flash('User deleted') return redirect(url_for('admin_page')) else: return redirect(url_for('admin_login_page')) except Exception as e: return render_template('error.html', resultsSET=e)
if updatescreen != 'ok': print('Warning. Screen feedtime did not update: ' + str(updatescreen)) print('Auto feed success') # Delete one off scheduled feeds now. Keep reoccuring feed schedules in DB. # Reoccuring daily feed times have date 1900-01-01 as placeholder in DB if str(x[2]) == '5': # Do not delete as scheduled will therefore be deleted. Deleted scheduled times through UI. print('Scheduled date. Do not delete') else: # Not a scheduled time. Can delete # Delete old scheduled records from DB con = commonTasks.connect_db() cur = con.execute( """delete from feedtimes where feeddate=? and feedtype in (0)""", [ str(x[0]), ]) con.commit() cur.close() con.close() print('Deleted old record from DB') break # Remove video files older then specified days now = time.time() nowMinusSpecifiedDays = now - int(nowMinusXDays) * 86400