Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6707039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:35:29+00:00 2026-05-26T07:35:29+00:00

I patched appengine_config to enable foreign characters with blobstoreuploadhandler: webapp_django_version = ‘1.2’ import base64

  • 0

I patched appengine_config to enable foreign characters with blobstoreuploadhandler:

webapp_django_version = '1.2'
import base64
import quopri

from webob import multidict


def from_fieldstorage(cls, fs):

    obj = cls()
    if fs.list:
        # fs.list can be None when there's nothing to parse
        for field in fs.list:
            if field.filename:
                obj.add(field.name, field)
            else:

                # first, set a common charset to utf-8.
                common_charset = 'utf-8'

                # second, check Content-Transfer-Encoding and decode
                # the value appropriately
                field_value = field.value
                transfer_encoding = field.headers.get(
                  'Content-Transfer-Encoding', None)

                if transfer_encoding == 'base64':
                    field_value = base64.b64decode(field_value)

                if transfer_encoding == 'quoted-printable':
                    field_value = quopri.decodestring(field_value)

                if field.type_options.has_key('charset') and \
                      field.type_options['charset'] != common_charset:
                    # decode with a charset specified in each
                    # multipart, and then encode it again with a
                    # charset specified in top level FieldStorage
                    field_value = field_value.decode(
                      field.type_options['charset']).encode(common_charset)

            # TODO: Should we take care of field.name here?
            obj.add(field.name, field_value)

    return obj

multidict.MultiDict.from_fieldstorage = classmethod(from_fieldstorage)

Now I get this error when performing an upload with a form that has just one file. Is it because I also need text values? If I remove the patch to appengine_config then my upload works but the foreign charcater breaks. Should I try adding just a hidden variable so that everyting that’s submitted isn’t just a file? Thanks for any good idea

Traceback (most recent call last):
  File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 703, in __call__
    handler.post(*groups)
  File "/base/data/home/apps/s~montaoproject/deleteoredit.354032237980992086/main.py", line 2659, in post
    for upload in self.get_uploads():
  File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/blobstore_handlers.py", line 348, in get_uploads
    for key, value in self.request.params.items():
  File "/base/python_runtime/python_lib/versions/1/webob/__init__.py", line 951, in params
    params = self.str_params
  File "/base/python_runtime/python_lib/versions/1/webob/__init__.py", line 943, in str_params
    return NestedMultiDict(self.str_GET, self.str_POST)
  File "/base/python_runtime/python_lib/versions/1/webob/__init__.py", line 870, in str_POST
    vars = MultiDict.from_fieldstorage(fs)
  File "/base/data/home/apps/s~montaoproject/deleteoredit.354032237980992086/appengine_config.py", line 44, in from_fieldstorage
    obj.add(field.name, field_value)
UnboundLocalError: local variable 'field_value' referenced before assignment
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:35:30+00:00Added an answer on May 26, 2026 at 7:35 am

    Indent “obj.add(field.name, field_value)” so that it is part of your else statement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is one method that monkey patched the Dir[] method from autotest class Dir
I'll be honest, I've patched together code from a couple of sources without really
Using Delphi 2010 and a patched version of the BDE I run into a
I am using the HtmlEditor Control included in the AjaxControlToolkit (patched version v62210 because
We run an old Windows NT Machine, fully patched running IIS4.0. Today we were
I have an ARM kit beside me and a Linux kernel source code patched
I have a LinearLayout which has a background image (a 9 patched png file).
I'm using gdb to connect to a 2.6.31.13 linux kernel patched with KGDB over
Our server got hacked via some SQL Injection method (now patched). All our PHP
I want to install a GC Patched Ruby to do a memory profiling on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.