Honestly I would like to refactor all this logic in web2py. It was already 
done for web3py:

https://github.com/mdipierro/web3py/blob/master/web3py/stream.py

Anyway, if you can help fix it in web2py, we can merge everything later

Massimo

On Monday, 4 February 2013 11:46:03 UTC-6, Paolo valleri wrote:
>
> I thought the same about postponing the opening of the file. Moreover, 
> just after globals:344 in the stream(...) function I have added
>
>         if isinstance(stream, file):
>             stream_file_or_304_or_206(stream.name,
>                                       chunk_size=chunk_size,
>                                       request=request,
>                                       headers=headers,
>                                       status=self.status)
>
> and finally I got a 304 :-). As a result we are on the right direction, 
> although there is no reason to open the file and take only its name. We 
> need definitely something better 
>
>  
>
>  Paolo
>
>
> 2013/2/4 Niphlod <nip...@gmail.com <javascript:>>
>
>>
>>
>> On Monday, February 4, 2013 3:38:29 PM UTC+1, Paolo valleri wrote:
>>>
>>> Hi Niphlod, I am still trying to understand why the wiki uploads are not 
>>> returned as 304. 
>>> The function in charged to return either 200 or 304 is 
>>> stream_file_or_304_or_206 in streamer.py. Moreover, this function is only 
>>> called in globals.py inside stream(...). Please have a look at 
>>> globals.py:344, In order to be called the parameter 'stream' must be a 
>>> string but with 'common' downloads the stream is an open file. This is also 
>>> documented by the comment in dal.py:9096. is what I've written correct ?
>>>
>>  
>> seems so, but in this case I think it should be patched (as soon as I'll 
>> get home). 
>>
>> For downloads that on the table are merely strings (i.e. on the table 
>> there's the path to the actual file, usually in the "uploads" folder) the 
>> correct way should be to "defer" the opening of the file down the line to 
>> gluon.streamer. 
>> A lot of logic has been added to store files on pyfilesystem (and without 
>> much tests on that, I hope I won't brake anything) but I think that for 
>> default "upload" file the logic needs to be revisited.
>>
>>  -- 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to