Пример #1
0
    def get(self, song_id, rec_id):
        if utils.is_number(song_id):
            song = Song.get_by_id(int(song_id))
        if song and utils.is_number(rec_id):
            rec = Recording.get_by_id(int(rec_id), parent=song.key())

        if song and rec:
            self.render("recording.html", song=song, audiolink=rec.audiolink, performer=rec.performer)
        else:
            self.error(404)
Пример #2
0
    def post(self, song_id, rec_id):
        if utils.is_number(song_id):
            song = Song.get_by_id(int(song_id))
        if song and utils.is_number(rec_id):
            rec = Recording.get_by_id(int(rec_id), parent=song.key())

        if song and rec:
            rec.delete_self()
            self.redirect(song.get_url())
        else:
            self.error(404)
Пример #3
0
    def post(self, song_id, rec_id):
        if utils.is_number(song_id):
            song = Song.get_by_id(int(song_id))
        if song and utils.is_number(rec_id):
            rec = Recording.get_by_id(int(rec_id), parent=song.key())

        audiolink = self.request.get("audiolink")
        performer = self.request.get("performer")
        if audiolink:
            rec.update(audiolink, performer)
            self.redirect("/song/" + str(song.key().id()))
        else:
            error = u"Линк не может быть пустым"
            self.render("recording.html", song=song, audiolink=audiolink, performer=performer, error=error)