[mod_python] Re: Mike's psp upload

Daniel Nogradi nogradi at gmail.com
Tue Feb 21 06:30:13 EST 2006


> I saw that traceback too, but it is util.py that is going wrong here:
>
> ## code snippet from mod_python/util.py
>     def __getitem__(self, key):
>         """Dictionary style indexing."""
>         if self.list is None:
>             raise TypeError, "not indexable"
>         found = []
>         for item in self.list:
>             if item.name == key:
>                 if isinstance(item.file, FileType) or \
>                        isinstance(getattr(item.file, 'file', None),
> FileType):
>                     found.append(item)
>                 else:
>                     found.append(StringField(item.value))
>         if not found:
>             raise KeyError, key
>         if len(found) == 1:
>             return found[0]
>         else:
>             return found
> ## end code snippet from mod_python/util.py
>
> The result is that the callback will ONLY work if you create a REAL file
> in make_file. Otherwise, the "isinstance(item.file, FileType)" will
> return FALSE and it creates a StringField, which attempts to read the
> whole file into memory (not a good idea). Then you get the stacktrace.
> It also means that you won't get the filename back from the form.
>
> I have submitted a patch that fixes the issue, but it is scheduled for
> 3.3 now.

Ooops, I overlooked that, thanks for the clarification.



More information about the Mod_python mailing list