def _q_index(req): name = req.get_form_var('name', '') content = req.get_form_var('content', '') online_date = req.get_form_var('online_date', '') upload_file = req.get_form_var("upload_file", None) user_ids = [] extra = {} error = None if req.get_method() == "POST": if not name or not online_date or not upload_file: error = 'miss_args' if error is None: id = Event.new(req.user.id, name, content, online_date, user_ids, extra) event = Event.get(id) if upload_file: error = event.update_photo(upload_file.tmp_filename) if not error: return req.redirect(event.path) return st('/event/edit.html', **locals())