示例#1
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)
示例#2
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)
示例#3
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)                
示例#4
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)                       
示例#5
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)                       
示例#6
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)