No, you can't return from a model, but you can raise an HTTP exception to
abort the models and return immediately -- something like:
import os
if request.controller == 'w2pstatic':
filepath = os.path.join(request.env.applications_parent, 'applications',
request.env.path_info[1:]).replace('w2pstatic', 'static')
try:
file = open(filepath, 'rb')
except:
raise HTTP(404)
else:
raise HTTP(200, response.stream(file), Expires='[expiration time]')
The above assumes your static URLs specify 'w2pstatic' as the controller,
but the files are really in the 'static' folder.
Anthony
On Saturday, June 9, 2012 8:46:13 PM UTC-4, Niphlod wrote:
>
> yes, I meant models
>
> do you mean something like
>
> models/00.py
>
> with in that
>
> def servstatic():
> .......
> return response.stream(file)
>
> ?
>
> so, having a model "return" will skip all models and controller/function
> execution ?
>