def get_post_form(self):
        self.__tainted = True
        post_form = self.__environ.get('wsgi.post_form')
        input = self.__environ['wsgi.input']
        if (post_form is not None
            and post_form[0] is input):
            return post_form[2]
        # This must be done to avoid a bug in cgi.FieldStorage
        self.__environ.setdefault('QUERY_STRING', '')

        ## Video handler hack:
        uri = self.__environ['PATH_INFO']
        if uri.endswith("upload_video"):
            tmp_shared = True
        else:
            tmp_shared = False
        fs = FieldStorage(self, keep_blank_values=1, to_tmp_shared=tmp_shared)
        if fs.wsgi_input_consumed:
            new_input = InputProcessed()
            post_form = (new_input, input, fs)
            self.__environ['wsgi.post_form'] = post_form
            self.__environ['wsgi.input'] = new_input
        else:
            post_form = (input, None, fs)
            self.__environ['wsgi.post_form'] = post_form
        return fs
    def _check(self, query, default, expected):
        req = _FakeReq(query)
        form = FieldStorage(req, keep_blank_values=True)
        result = webinterface_handler.wash_urlargd(form, default)

        if not 'ln' in expected:
            expected['ln'] = CFG_SITE_LANG

        self.failUnlessEqual(result, expected)
 def get_post_form(self):
     post_form = self.__environ.get('wsgi.post_form')
     input = self.__environ['wsgi.input']
     if (post_form is not None and post_form[0] is input):
         return post_form[2]
     # This must be done to avoid a bug in cgi.FieldStorage
     self.__environ.setdefault('QUERY_STRING', '')
     fs = FieldStorage(self, keep_blank_values=1)
     if fs.wsgi_input_consumed:
         new_input = InputProcessed()
         post_form = (new_input, input, fs)
         self.__environ['wsgi.post_form'] = post_form
         self.__environ['wsgi.input'] = new_input
     else:
         post_form = (input, None, fs)
         self.__environ['wsgi.post_form'] = post_form
     return fs