Re: mod_python 3.2.3b available for testing
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Mod-Python > Re: mod_python 3.2.3b available for testing




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Re: mod_python 3.2.3b available for testing  
Nick


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-25-05 10:46 PM

Well, here's another alternative: provide some other attribute to Field,
such as is_file, to determine whether or not the Field is an actual file
upload or something else.  Because as implemented, the file attribute will
always return a file-type object.

Nick

Nick wrote:
> Jorey Bump wrote:
> 
>
>
> At a minimum, the documentation:
>
> "This is a file object. For file uploads it points to a temporary file.
> For simple values, it is a StringIO object, so you can read simple
> string values via this attribute instead of using the value  attribute
> as well."
>
> As I stated, it just may be enough to document here that it's a file
> -or- a file-type object.  That's what the Python documentation for
> tempfile.TemporaryFile states, so maybe calling it a "bug" is wrong.
> But it's equally simple to return the actual file object, and in my
> opinion more convenient for programmers to do isinstance(field.file,
> file) to see if you have an uploaded file vs. some other kind of value.
> I don't know enough about Windows though to know what will happen if you
> garbage collect the tempfile._TemporaryFileWrapper object but keeping a
> reference to the file.
>
> It's unfortunate that it's not possible to subclass a builtin type and
> overload its methods (that I know of).
>
> Nick







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 05:46 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register