def delete(): dbsess = get_session() rule_id = request.form.get("rule_id") r = Rule.get(Rule.id == rule_id, sess=dbsess) if r: dbsess.delete(r[0]) dbsess.commit() flash(u"予約ルールを削除しました") return redirect(url_for("index"))
def add(): dbsess = get_session() if request.method == "POST" and request.form.get("keyword"): rule = Rule(conditions=generate_conditions()) dbsess.add(rule) dbsess.commit() reserve_ctrl = u'<a class="reserve_ctrl" href="#reserve%s">»すぐに録画予約を行う</a>' % rule.id flash(u"予約ルールを追加しました %s" % reserve_ctrl) return redirect(url_for("index")) return render_template("add.html", channels=Channel.list(sess=dbsess))
def __init__(self): self.sess = get_session() self.logger = settings.logging.getLogger('reserveshell') self.remote_api = RemoteAPI(username=settings.REMOTE_USERNAME, password=settings.REMOTE_PASSWORD)
def __init__(self): self.program_api = ProgramAPI() self.sess = get_session() self.logger = logging.getLogger('storeshell')
def index(): dbsess = get_session() rules = Rule.get(sess=dbsess) reserved = Program.get_reserved(sess=dbsess) return render_template("index.html", rules=rules, reserved_programs=reserved)