Tim, did you try with the IS_IMAGE validator?

On Apr 27, 7:56 am, Timothy Farrell <[email protected]> wrote:
> Let us know if it comes up again.
>
> -tim
>
> On 4/27/2010 1:30 AM, hywang wrote:
>
> > when i try it again today, everything is ok today.
> > I don't know why :-(
>
> > On 4月26日, 下午11时42分, mdipierro<[email protected]>  wrote:
>
> >> I cannot reproduce this either. It is not an internationalization
> >> issue. I suspect something else in the code is causing this. We need
> >> to see at the entire code.
>
> >> On Apr 26, 10:37 am, Timothy Farrell<[email protected]>  wrote:
>
> >>> My assumption that web2py is returning something other than a list comes
> >>> from the traceback.  Why would calling:
>
> >>> len(returned_obj)
>
> >>> go into the cgi module if it was a string?  Rocket alone does not use
> >>> the cgi module at all so the returned object must be related to it
> >>> somehow.  We know that lists that contain strings do not relate to the
> >>> cgi module.
>
> >>> All that aside, there's something more going on here.  I've plugged
> >>> hwangs code into a test application here and could not reproduce the
> >>> problematic behavior.  The only changes I made to the code posted was
> >>> changing request.flash = 'ok' to response.flash = 'ok' and adding a db =
> >>> DAL('sqlite://storage.db') to the model file.
>
> >>> Could there be a i18n/l10n issue here?
>
> >>> -tim
>
> >>> On 4/26/2010 9:16 AM, mdipierro wrote:
>
> >>>> I think we need some debugging. His code is
>
> >>>> def hello():
> >>>>       form = SQLFORM(db.easy_test)
> >>>>       if form.accepts(request.vars, session):
> >>>>           request.flash = 'ok'
> >>>>       return dict(form=form)
>
> >>>> and web2py returns a list with a string in this case (the generic view
> >>>> that renders the dict()). I do not see how web2py can return anything
> >>>> else.
>
> >>>> On Apr 26, 8:04 am, Timothy Farrell<[email protected]>    wrote:
>
> >>>>> Massimo, I know you sent me an email on this but I can't find it so I'll
> >>>>> just reply to the list.
>
> >>>>> Rocket is dying in this case because the object it has received from
> >>>>> web2py is not a valid WSGI response. A valid WSGI response must be
> >>>>> either a list or generator (Rocket is a little more tolerant and will
> >>>>> accept a string as well). But in this case it seems to be getting some
> >>>>> form of a cgi.FieldStorage type as evidenced by the traceback going into
> >>>>> the cgi module when Rocket tries to read the length of the returned 
> >>>>> object.
>
> >>>>> Massimo, I've seen the web2py code that it normally scrubs returned
> >>>>> objects. This was a while ago and may have changed since then.
>
> >>>>> Rocket could die a little more gracefully, but I'd rather keep the code
> >>>>> lean rather than checking every response for validity. As a test, there
> >>>>> is a WSGI validator in the wsgiref module that works as middleware. You
> >>>>> might hook that up to see what is really coming back.
>
> >>>>> -tim
>
> >>>>> On 4/26/2010 1:53 AM, hywang wrote:
>
> >>>>>> i has no view .
> >>>>>> when i test newest version in google hg server, web2py works well,
> >>>>>> but if I add IS_IMAGE() validator, some error occured again.
>
> >>>>>> ver1.6x works well
>
> >>>>>> On 4 26 , 2ʱ01 , mdipierro<[email protected]>    wrote:
>
> >>>>>>> Do you have a view with a custom form?
>
> >>>>>>> On Apr 25, 10:53 pm, hywang<[email protected]>    wrote:
>
> >>>>>>>> I run web2py from source on centos 5.3.
> >>>>>>>> When upload a file, an error occurs.
> >>>>>>>> -----db.py-----------
> >>>>>>>> db.define_table('easy_test',
> >>>>>>>>       Field('picture', 'upload')
> >>>>>>>> )
>
> >>>>>>>> ---------controller file---------------
> >>>>>>>> def hello():
> >>>>>>>>       form = SQLFORM(db.easy_test)
> >>>>>>>>       if form.accepts(request.vars, session):
> >>>>>>>>           request.flash = 'ok'
> >>>>>>>>       return dict(form=form)
>
> >>>>>>>> when submit the form, it returns 'server error'
> >>>>>>>> consel error msg :
> >>>>>>>> ERROR:Rocket.Errors.Thread-3:Traceback (most recent call last):
> >>>>>>>>     File "E:\web2py\gluon\rocket.py", line 747, in run
> >>>>>>>>       self.run_app(conn)
> >>>>>>>>     File "E:\web2py\gluon\rocket.py", line 1162, in run_app
> >>>>>>>>       sections = len(output)
> >>>>>>>>     File "C:\Python25\lib\cgi.py", line 633, in __len__
> >>>>>>>>       return len(self.keys())
> >>>>>>>>     File "C:\Python25\lib\cgi.py", line 609, in keys
> >>>>>>>>       raise TypeError, "not indexable"
> >>>>>>>> TypeError: not indexable
>
> >>>>>>>> --
> >>>>>>>> Subscription 
> >>>>>>>> settings:http://groups.google.com/group/web2py/subscribe?hl=en

Reply via email to