Пример #1
0
    def _do_edit_form_video(self, media_id):
        c.video = h.get_media_by_id(media_id)
        body = request.POST.get('body', u'')
        if not body:
            abort(400)

        c.video.text = h.clean_embed_markup(body)
        meta.Session.commit()

        c.editable = True
        return dict(html=render('/media/video/item.mako'))
Пример #2
0
    def _do_new_form_video(self, almanac_slug, page_slug=None):
        c.almanac = h.get_almanac_by_slug(almanac_slug)
        body = request.POST.get('body', u'')
        if not body:
            abort(400)

        page = self._retrieve_page(c.almanac, page_slug)

        c.video = video = Video()
        video.text = h.clean_embed_markup(body)
        video.page_id = page.id
        video.order = len(page.media)
        meta.Session.add(video)
        meta.Session.commit()

        c.editable = True
        return dict(html=render('/media/video/item.mako'))