Example #1
0
 def index(self):
     data_dict = {
         'title': 'Welcome to the poll application!',
         'links': get_global_links(),
     }
     templ = env.get_template('index.html')
     return templ.render(data_dict)
Example #2
0
 def index(self):
     data_dict = {
         'title': 'Welcome to the poll application!',
         'links': get_global_links(),
     }
     templ = env.get_template('index.html')
     return templ.render(data_dict)
Example #3
0
 def index(self):
     data_dict = {
         'title': 'Poll List',
         'links': get_global_links(),
         'polls': get_polls(),
     }                                             
     templ = env.get_template('polls.html')        
     return templ.render(data_dict)                
Example #4
0
 def index(self):
     data_dict = {
         'title': 'Poll List',
         'links': get_global_links(),
         'polls': get_polls(),
     }                                             
     templ = env.get_template('polls.html')        
     return templ.render(data_dict)                
Example #5
0
 def add(self, **kwargs):
     method = cherrypy.request.method.upper()
     poll = False
     data_dict = {"title": "Add a poll", "links": get_global_links()}
     if method == "POST":
         add_poll(**kwargs)
         data_dict["success"] = True
     templ = env.get_template("add_poll.html")
     return templ.render(data_dict)
Example #6
0
 def edit(self, key, **kwargs):
     method = cherrypy.request.method.upper()
     poll = False
     data_dict = {"title": "Edit your poll", "links": get_global_links()}
     if method == "POST":
         poll = edit_poll(**kwargs)
         data_dict["poll"] = poll
         data_dict["success"] = True
     else:
         data_dict["poll"] = get_poll(key)
     templ = env.get_template("edit_poll.html")
     return templ.render(data_dict)
Example #7
0
 def add(self,**kwargs):
     method = cherrypy.request.method.upper()       
     poll = False                                   
     data_dict = {                                        
         'title': 'Add a poll',                           
         'links': get_global_links(),                     
     }                                                    
     if method == 'POST':                           
         add_poll(**kwargs)
         data_dict['success'] = True
     templ = env.get_template('add_poll.html')        
     return templ.render(data_dict)                
Example #8
0
 def add(self,**kwargs):
     method = cherrypy.request.method.upper()       
     poll = False                                   
     data_dict = {                                        
         'title': 'Add a poll',                           
         'links': get_global_links(),                     
     }                                                    
     if method == 'POST':                           
         add_poll(**kwargs)
         data_dict['success'] = True
     templ = env.get_template('add_poll.html')        
     return templ.render(data_dict)                
Example #9
0
 def poll(self, key, choice=None):
     method = cherrypy.request.method.upper()
     poll = False
     data_dict = {"title": "Poll", "links": get_global_links()}
     if method == "POST":
         data_dict["poll"] = cast_vote(key, choice)
         data_dict["success"] = True
     else:
         data_dict["poll"] = get_poll(key)
     if not data_dict.get("poll"):
         raise cherrypy.HTTPError(404)
     templ = env.get_template("poll.html")
     return templ.render(data_dict)
Example #10
0
 def poll(self,key,choice=None):
     method = cherrypy.request.method.upper()
     poll = False
     data_dict = {
         'title': 'Poll',
         'links': get_global_links(),
     }                                             
     if method == 'POST':
         data_dict['poll'] = cast_vote(key,choice)
         data_dict['success'] = True
     else:
         data_dict['poll'] = get_poll(key)
     templ = env.get_template('poll.html')        
     return templ.render(data_dict)                
Example #11
0
 def edit(self,key,**kwargs):
     method = cherrypy.request.method.upper()       
     poll = False                                   
     data_dict = {                                        
         'title': 'Edit your poll',                           
         'links': get_global_links(),        
     }                                                    
     if method == 'POST':   
         poll = edit_poll(**kwargs)
         data_dict['poll'] = poll
         data_dict['success'] = True
     else:
         data_dict['poll'] = get_poll(key)
     templ = env.get_template('edit_poll.html')        
     return templ.render(data_dict)                       
Example #12
0
 def edit(self,key,**kwargs):
     method = cherrypy.request.method.upper()       
     poll = False                                   
     data_dict = {                                        
         'title': 'Edit your poll',                           
         'links': get_global_links(),        
     }                                                    
     if method == 'POST':   
         poll = edit_poll(**kwargs)
         data_dict['poll'] = poll
         data_dict['success'] = True
     else:
         data_dict['poll'] = get_poll(key)
     templ = env.get_template('edit_poll.html')        
     return templ.render(data_dict)                       
Example #13
0
 def poll(self,key,choice=None):
     method = cherrypy.request.method.upper()
     poll = False
     data_dict = {
         'title': 'Poll',
         'links': get_global_links(),
     }                                             
     if method == 'POST':
         data_dict['poll'] = cast_vote(key,choice)
         data_dict['success'] = True
     else:
         data_dict['poll'] = get_poll(key)
     if not data_dict.get('poll'):
         raise cherrypy.HTTPError(404)
     templ = env.get_template('poll.html')        
     return templ.render(data_dict)                
Example #14
0
 def index(self):
     data_dict = {"title": "Welcome to the poll application!", "links": get_global_links()}
     templ = env.get_template("index.html")
     return templ.render(data_dict)
Example #15
0
 def index(self):
     data_dict = {"title": "Poll List", "links": get_global_links(), "polls": get_polls()}
     templ = env.get_template("polls.html")
     return templ.render(data_dict)