Exemplo n.º 1
0
def reminder_mail(touts, rem):
    for t in touts:
        learner = t.learner.get()
        mentor = t.teacher.get()
        if rem == 24:
            falta = "24 horas"
            subject = u'Recuerda tu sesión en 24 horas'
        else:
            falta = "minutos"
            subject = u'Recuerda que tu sesión comenzará pronto'
        date_user = t.date - datetime.timedelta(minutes=learner.timezoneOffset)
        date_mentor = t.date - datetime.timedelta(minutes=mentor.timezoneOffset)
        html_user = main.render_str("mail_reminder.html", para=learner, de=mentor, t=t, falta=falta, date=date_user)
        html_mentor = main.render_str("mail_reminder.html", para=mentor, de=learner, t=t, falta=falta, date=date_mentor)
        mail.send_mail("TeachMe <*****@*****.**>", learner.mail, subject, "", html=html_user)
        mail.send_mail("TeachMe <*****@*****.**>", mentor.mail, subject, "", html=html_mentor)
Exemplo n.º 2
0
 def render(self, user, is_static=False):
     """
     Renders the page. Passes through user and is_static for
     other renderers to use.
     """
     return main.render_str("post.html",
                            post=self,
                            user=user,
                            is_static=is_static)
Exemplo n.º 3
0
 def render_post_editor(cls, subject="", content="", error=""):
     """
     Renders the page editor. For new posts or comments and post
     or comment editing.
     """
     return main.render_str('post_editor.html',
                            subject=subject,
                            content=content,
                            error=error)
Exemplo n.º 4
0
 def render(self, user=None, players=list([])):
     if self.is_finished:
         winners = []
         for winner in list(self.results):
             if winner=="Player1":
                 winners.append([1,0,0])
             elif winner=="Player2":
                 winners.append([0,1,0])
             elif winner=="Draw":
                 winners.append([0,0,1])
     return main.render_str("round.html", number = self.number, matches=self.get_matches(), user = user, p1_ids=self.p1_ids, is_finished=self.is_finished)
Exemplo n.º 5
0
 def render_comment(cls, comment_id, user, is_static=False):
     """
     Renders the given comment for the given post. If no comment ID
     is given, attempts to render the current comment. If small is
     True renders the condensed version for pages with multipl
     posts.
     """
     if not is_static:
         comment_renderer = "comment_sml.html"
     else:
         comment_renderer = "comment.html"
     return main.render_str(comment_renderer,
                            comment=cls.by_id(int(comment_id)),
                            user=user)
Exemplo n.º 6
0
 def render(self):
     self._render_text = self.content.replace('\n', '<br>')
     return main.render_str("post.html", p=self)
Exemplo n.º 7
0
 def render(self):
     self._render_text = self.content.replace("\n", "<br>")
     # calls the html template to render the post
     return main.render_str("post.html", p=self)
Exemplo n.º 8
0
 def render(self):
     return render_str("post.html", p = self)
Exemplo n.º 9
0
 def render(self):
     return main.render_str("player.html", player = self)
Exemplo n.º 10
0
 def render_dislike(cls, post, disabled=False):
     """
     Renders the dislike for the post. If disabled is True, renders
     the disabled version.
     """
     return main.render_str('dislike.html', disabled=disabled, post=post)