I'd suggest playing around in the paster shell to play with your model with:

> paster shell development.ini

Then you will get a shell like:

> Pylons Interactive Shell
>
>   All objects from campsite.lib.base are available
>   Additional Objects:
>   mapper     -  Routes mapper object
>   wsgiapp    -  This project's WSGI App instance
>   app        -  paste.fixture wrapped around wsgiapp
>
> >>> model.MyTable.query().all()
>

But you can do something like:

model.MyTable.query().all()
>
instead of

> model.MyTable.query().one()
>
or use a try/except around your call to one()

sort of depends on if you are always expecting 1 result or not.


On Tue, Jun 17, 2008 at 3:42 AM, Joe Chiang <[EMAIL PROTECTED]> wrote:

>
> Sorry I am a completely newbie to Pylons, Python, and I'm trying to
> built a web page with pylons..
> so i got a page setup and have it query to my database for
> searching..
> query is fine when user enter the correct arguments
> but when they are not
>
> below is a pylons pages with error log
>
> <class 'sqlalchemy.exceptions.InvalidRequestError'>: No rows returned
> for one()
>
> is there anyway that i can make it a page display a alert or something
> to user? or search it anyway?
>
> thanks for your time and help
>
> >
>


-- 
http://twitter.com/rpf
http://rickflosi.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to