Advertisement
mmornati

Untitled

Aug 25th, 2011
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1. def execute_action_form(request, agent, action, xhr=None):
  2.     if request.method == "POST":
  3.         inputs = get_action_inputs(agent, action)
  4.         logger.debug("Recreating form")
  5.         form_type = create_action_form(inputs)
  6.         form = form_type(request.POST)
  7.        
  8.         #TODO: Verify if we can remove this workaround
  9.         #Added to fix bugs during first creation of form (in debug mode there is no problem)
  10.         try:
  11.             form.is_valid()
  12.         except Exception, e:
  13.             logger.debug(e)
  14.         #End Bug workaround    
  15.        
  16.         #Check if the <xhr> var had something passed to it.
  17.         if xhr == "xhr":
  18.             # Yup, this is an Ajax request.
  19.             # Validate the form:
  20.             clean = form.is_valid()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement