Exemple #1
0
    def test_all(self):

        all_news = News.all()
        self.assertEqual(len(all_news), 4)

        # Checks the order by clause
        self.assertEqual(all_news[0].news_dt, datetime.date(2011, 8, 15))
        self.assertEqual(all_news[1].news_dt, datetime.date(2011, 7, 13))
        self.assertEqual(all_news[2].news_dt, datetime.date(2011, 6, 10))
        self.assertEqual(all_news[3].news_dt, datetime.date(2011, 5, 27))
Exemple #2
0
 def test_all(self):
     
     all_news = News.all()
     self.assertEqual(len(all_news), 4)
     
     # Checks the order by clause
     self.assertEqual(all_news[0].news_dt, datetime.date(2011, 8, 15))
     self.assertEqual(all_news[1].news_dt, datetime.date(2011, 7, 13))
     self.assertEqual(all_news[2].news_dt, datetime.date(2011, 6, 10))
     self.assertEqual(all_news[3].news_dt, datetime.date(2011, 5, 27))
Exemple #3
0
 def GET(self):
     
     open_polls = filter(lambda poll: not poll.expired, Poll.all())
     
     return config.views.layout(
         config.views.index(
             pending_tournaments(),
             open_polls,
             News.all()
         )
     )
Exemple #4
0
    def __init__(self):

        # Grid initialization
        super(EditNewsGrid, self).__init__(News, News.all())
        
        # Creation of a customized date field to edit the news' date
        self.append(create_date_field("formatted_news_dt", "news_dt", DT_FORMAT))
        
        # Grid configuration
        inc = [FORMATTED_DT(self.formatted_news_dt), NEWS(self.news)] 
        self.configure(include=inc)
Exemple #5
0
    def __init__(self):

        # Grid initialization
        super(EditNewsGrid, self).__init__(News, News.all())

        # Creation of a customized date field to edit the news' date
        self.append(
            create_date_field("formatted_news_dt", "news_dt", DT_FORMAT))

        # Grid configuration
        inc = [FORMATTED_DT(self.formatted_news_dt), NEWS(self.news)]
        self.configure(include=inc)
Exemple #6
0
    def GET(self):

        open_polls = filter(lambda poll: not poll.expired, Poll.all())

        return config.views.layout(
            config.views.index(pending_tournaments(), open_polls, News.all()))