Beispiel #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)
Beispiel #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)
Beispiel #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)
 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)
Beispiel #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)
Beispiel #6
0
 def render(self):
     self._render_text = self.content.replace('\n', '<br>')
     return main.render_str("post.html", p=self)
Beispiel #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)
Beispiel #8
0
 def render(self):
     return render_str("post.html", p = self)
 def render(self):
     return main.render_str("player.html", player = self)
Beispiel #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)