def send_confirmation_email(web):
    f = SignupEmailForm()
    if not f.is_valid(web.input()):
        return juno.template('signup/new.html', {'web':web, 'errors':f.errors})
    uce = model.user.UserConfirmationEmail(web.input('email'))
    uce.send()
    return juno.template('signup/sent_confirmation_email.html', {'web':web})
Example #2
0
 def today(web):
     rtorrent = RTorrent()
     torrents, history = rtorrent.today()
     template(
         "index.tpl",
         torrents=torrents,
         queue=rtorrent.get_queue(),
         history=history,
         status=rtorrent.get_status(),
     )
Example #3
0
def datenspuren(web, errors=[]):
    try: # FIXME wrap db queries into one
        episodes = Episode.find().filter(Episode.category.startswith("ds")).\
                order_by(Episode.date).all()
        episodes.reverse()
        comments_count, ratings = [], []
        for episode in episodes:
            ids = list(map(lambda e:e.id, Episode.find(Episode.id).\
                filter_by(category = "file/{0}/{1}".\
                format(episode.category, episode.link)).all()))
            f_rts = Rating.find().filter(Rating.episode.in_(ids)).all()
            e_rts = Rating.find().filter_by(episode = episode.id).all()
            ratings += [ do_the_ratings(web, "", e_rts + f_rts)['rating'] ]
            comments_count += [
                Comment.find().filter(Comment.episode.in_(ids)).count() +
                Comment.find().filter_by( episode = episode.id).count() ]
            count = File.find().filter_by(episode = episode.id).count()
            episode.filescount = "// {0} File{1}".format(count,
                count != 1 and "s" or "")
    except Exception as e: return notfound(str(e))
    return template("episodes.tpl",
                    errors      = errors,
                    css         = "episode",
                    episodepage = zip(episodes, comments_count, ratings),
                    site        = "datenspuren"
                   )
Example #4
0
def datenspur(web, id, mode, errors=[]):
    try: # FIXME wrap db queries into one
        episodes = Episode.find().filter(Episode.category.endswith(id)).\
                order_by(Episode.date).all()
        episodes.reverse()
        comments_count = [ Comment.find().filter_by(episode = e.id).count()
                        for e in episodes ]
        ratings = [ do_the_ratings(web, "", Rating.find().\
                    filter_by(episode = e.id).all())['rating']
                    for e in episodes ]
        episode = Episode.find().filter_by(link = id).one()
        for ep in episodes:
            ep.has_screen = True
            ep.files = File.find().filter_by(episode = ep.id).all()
            ep.preview = get_preview(Preview.find().\
                filter_by(episode = episode.id).all(), ep.files)
        comments = Comment.find().filter_by(episode = episode.id).all()
        rating = Rating.find().filter_by(episode = episode.id).all()
    except Exception as e: return notfound(str(e))
    if mode is None: mode = ""
    if len(mode): mode = mode[1:]
    opts = {}
    opts.update(create_session(web, mode))
    opts.update(do_the_comments(web, mode, comments))
    opts.update(do_the_ratings(web, mode, rating))
    return template("datenspuren.tpl",
                    errors      = errors,
                    css         = "episode",
                    episodepage = zip(episodes, comments_count, ratings),
                    site        = "datenspuren",
                    full_site   = "datenspuren/" + id,
                    episode     = episode,
                    **opts
                   )
def create(web):
    if not verify_email_key(web):
        return
    
    f = SignupForm()
    if not f.is_valid(web.input()):
        return juno.template('signup/signup.html', {'web':web, 'errors':f.errors})
    
    user = auth = None
    try:
        user = model.user.User(
            account=web.input('account'),
            fullname=web.input('fullname')
            )
        user.put()
        salt = model.user.UserAuthentication.generate_salt()
        auth = model.user.UserAuthentication(
            user=user,
            email=web.input('email'),
            salt=salt,
            crypted_password=model.user.UserAuthentication.crypt_password(web.input('password'), salt),
            )
        auth.put()
        juno.session.set_user(user)
    except Exception, e:
        user and user.is_saved() and user.delete()
        auth and auth.is_saved() and auth.delete()
        if not isinstance(e, not DuplicatePropertyError):
            raise e
Example #6
0
def comments_per_episode(web, episode, comments, site, mode):
    comments = build_comment_tree(comments)
    if mode == "atom":
        return template_atom(
            title    = "Pentamedia-Portal // {0} // Comments".format(episode.name),
            episodes = {episode.id: episode},
            comments = comments
                            )
    elif mode == "json":
        if web.input("html"):
            html = template("comments.inner_html.tpl",
                            isjson       = True,
                            episode      = episode,
                            site         = site,
                            comments     = comments
                           )
            return template_json(web, {
                "html"    : html.body,
                "new_link": "/{0}/{1}/comments/comment#new".format(site, episode.link)
                                })
        return template_json(web ,{
            "comments": list(map(comment_to_json,comments)),
            "new_link": "/{0}/{1}/comments/comment#new".format(episode.category, episode.link)
                            })
    else:  return notfound("Type not supported.")
Example #7
0
def episode(web, site, id, mode, errors=[]):
    try: # FIXME wrap db queries into one
        episode  = Episode.find().filter_by(link = id).one()
        files    = File.find().filter_by(episode = episode.id).all()
        links    = Link.find().filter_by(episode = episode.id).all()
        comments = Comment.find().filter_by(episode = episode.id).\
                   order_by(Comment.date).all()
        ratings  = Rating.find().filter_by(episode = episode.id).all()
        trackbacks = Trackback.find().filter_by(episode = episode.id).\
                     order_by(Trackback.date).all()
    except Exception as e: return notfound(str(e))
    if mode is None: mode = ""
    if len(mode): mode = mode[1:]
    opts = {}
    opts.update(create_session(web, mode))
    opts.update(do_the_comments(web, mode, comments))
    opts.update(do_the_ratings(web, mode, ratings))
    return template("episode.tpl",
                    errors     = errors,
                    css        = "episode",
                    episode    = episode,
                    episodes   = {episode.id: episode},
                    site       = site,
                    trackbacks = trackbacks,
                    files      = files,
                    links      = links,
                    csss       = [ "../lib/audio-js/audio-js",
                                   "../lib/audio-js/skins/vim",
                                   "vim"],
                    **opts
                   )
Example #8
0
def rating_per_episode(web, episode, ratings, site, mode):
    opts = do_the_ratings(web, mode, ratings)
    opts.update( rating_form = False, site = site, episode = episode)
    if mode == "json":
        if web.input('html'):
            html = template("rating.inner_html.tpl", isjson = True, **opts)
            return template_json(web, {
                "html"     : html.body,
                "new_link" : "/{0}/{1}/ratings/rate#new".format(site, episode.link)
                                })
        return template_json(web ,{
            "rating": opts['rating'],
            "new_link": "/{0}/{1}/ratings/rate#new".format(episode.category, episode.link)
                            })
    else:  return notfound("Type not supported.")
Example #9
0
def template_mode(web, site, episode, mode, **kwargs):
    opts, func = {}, template_comments
    if mode is None: mode = ""
    if len(mode): mode = mode[1:]
    if mode in _template_functions:
        func = _template_functions[mode]
    tpl, worker = func()
    kwargs = dict(kwargs)
    kwargs.update(site = site, episode = episode)
    wopts = worker(web, mode, **kwargs)
    opts.update(create_session(web, mode))
    opts.update(css = "episode")
    opts.update(kwargs)
    opts.update(wopts)
    return template(tpl, **opts)
Example #10
0
def start(web): # FIXME wrap db queries into one
    episodes = {}
    for category in ['pentaradio','pentamusic','pentacast']:
        episode = list(reversed(Episode.find().\
                    filter_by(category=category).\
                    order_by(Episode.date).\
                    all()
                   ))
        if len(episode) > 13:
            episode = episode[:13]
            episode.append({'name': "moreā€¦", 'link': ""})
        episodes[category] = episode
    return template("start.html",
                    episodes = episodes,
                    css      = "start"
                   )
Example #11
0
def main(web, site, errors=[]):
    try: # FIXME wrap db queries into one
        episodes = Episode.find().filter_by(category=site).\
                order_by(Episode.date).all()
        episodes.reverse()
        comments_count = [ Comment.find().filter_by(episode = e.id).count()
                        for e in episodes ]
        ratings = [ do_the_ratings(web, "", Rating.find().\
                    filter_by(episode = e.id).all())['rating']
                    for e in episodes ]
    except Exception as e: return notfound(str(e))
    return template("episodes.tpl",
                    errors      = errors,
                    css         = "episode",
                    episodepage = zip(episodes, comments_count, ratings),
                    site        = site
                   )
Example #12
0
def datenspur_file(web, id, filename, mode, errors=[]):
    try: # FIXME wrap db queries into one
        episode = Episode.find().filter_by(link = filename).\
                filter(Episode.category.endswith(id)).\
                order_by(Episode.date).one()
        comments = Comment.find().filter_by(episode = episode.id).all()
        files    = File.find().filter_by(episode = episode.id).all()
        ratings  = Rating.find().filter_by(episode = episode.id).all()
        previews = Preview.find().filter_by(episode = episode.id).all()
        trackbacks = Trackback.find().filter_by(episode = episode.id).\
                    order_by(Trackback.date).all()
    except Exception as e: return notfound(str(e))
    episode.files = files
    if mode is None: mode = ""
    if len(mode): mode = mode[1:]
    opts = {}
    opts.update(create_session(web, mode))
    opts.update(do_the_comments(web, mode, comments))
    opts.update(do_the_ratings(web, mode, ratings))
    preview = get_preview(previews, files)
    csss = [ "../lib/video-js/video-js", "../lib/video-js/skins/vim", "vim"]
    if episode.isaudio():
        csss = list(map(lambda s:s.replace("video", "audio"), csss))
    return template("datenspur.tpl",
                    errors     = errors,
                    css        = "episode",
                    episode    = episode,
                    episodes   = {episode.id: episode},
                    site       = "datenspuren",
                    full_site  = "datenspuren/" + id,
                    trackbacks = trackbacks,
                    files      = files,
                    preview    = preview,
                    csss       = csss,
                    **opts
                   )
Example #13
0
def donate(web):
    return template("spenden.tpl")
def confirm_email(web):
    if not verify_email_key(web):
        return
    return juno.template('signup/signup.html', {'web':web})
Example #15
0
def template_tb(**kwargs):
    response = template("trackback.tpl",**kwargs)
    header('Content-Type',"text/xml")
    return response
Example #16
0
 def archives(web):
     rtorrent = RTorrent()
     template("index.tpl", history=rtorrent.archives(), status=rtorrent.get_status())
def index(web):
    return juno.template('signup/new.html', {'web':web})
Example #18
0
def template_episodes_atom(**kwargs):
    header('Content-Type', "application/atom+xml")
    return template("episodes_atom.tpl",
                    remove_html = remove_html,
                    clean_category = clean_category,
                    pentamediaportal = pentamediaportal, **kwargs)
Example #19
0
def template_atom(**kwargs):
    header('Content-Type', "application/atom+xml")
    return template("comments_atom.tpl",
                    pentamediaportal = pentamediaportal, **kwargs)
        return
    
    f = SignupForm()
    if not f.is_valid(web.input()):
        return juno.template('signup/signup.html', {'web':web, 'errors':f.errors})
    
    user = auth = None
    try:
        user = model.user.User(
            account=web.input('account'),
            fullname=web.input('fullname')
            )
        user.put()
        salt = model.user.UserAuthentication.generate_salt()
        auth = model.user.UserAuthentication(
            user=user,
            email=web.input('email'),
            salt=salt,
            crypted_password=model.user.UserAuthentication.crypt_password(web.input('password'), salt),
            )
        auth.put()
        juno.session.set_user(user)
    except Exception, e:
        user and user.is_saved() and user.delete()
        auth and auth.is_saved() and auth.delete()
        if not isinstance(e, not DuplicatePropertyError):
            raise e
    
    return juno.template('signup/signedup.html', {'web':web})