Beispiel #1
0
 def create(self):
     user = users.get_current_user()
     if user:
         c.title = " | Create a New Deck"
         return render('/create_deck.mako')
     else:
         c.login_url = users.create_login_url(h.url_for(controller="Deck", action="create"))
         return render('/login.mako')
Beispiel #2
0
 def delete(self, deck_id=None):
     if users.is_current_user_admin():
         c.deck = Deck.get_current_by_id_base30(deck_id)
         c.cards = Card.get(c.deck.cards)
         c.title = " | " + c.deck.name
         return render('/delete_deck.mako')
     else:
         #XXX Proper http error here
         raise 'error'
Beispiel #3
0
 def quiz(self, deck_id=None):
     c.deck = Deck.get_current_by_id_base30(deck_id)
     c.cards = Card.get(c.deck.cards)
     c.title = "| " + c.deck.name + " Quiz"
     c.reverse = bool(request.params.get('reverse', False))        
     return render('quiz_deck.mako')
Beispiel #4
0
 def xml(self, deck_id=None):
     response.headers['Content-type'] = "Content-Type: application/xml; charset=utf-8" 
     c.deck = Deck.get_current_by_id_base30(deck_id)
     c.cards = Card.get(c.deck.cards)                    
     return render('/xml_deck.mako')
Beispiel #5
0
 def view(self, deck_id=None):
     c.is_admin = users.is_current_user_admin()
     c.deck = Deck.get_current_by_id_base30(deck_id)
     c.cards = Card.get(c.deck.cards)
     c.title = " | " + c.deck.name
     return render('/show_deck.mako')
Beispiel #6
0
 def index(self):
     c.decks = Deck.all().filter("show =", True)
     return render('/show_decks.mako')
Beispiel #7
0
 def index(self):
     return render('/about.mako')