On 10/6/07, Ken <[EMAIL PROTECTED]> wrote:
>
>
> hi, I had the same problem.
> check the lenth of obj, is 1.
> when the template file use $item.id
> debugger reports the same infomation...
> my code like this:
> # code.py
> ...
>
item = web.select('todo', where='id=$id', vars=locals())


change the above line to

item = web.select('todo', where='id=$id', vars=locals())[0]

# when i check item's length , it is 1.
> # sql like: select * from todo where id=15. in MYSQL, I checked, it is
> ok
> render.edit(item)
> ...
>
> # templates/edit.html
> $def with (item)
> <form action="/item/$item.id/save/" method="post">
> ...
>
> # http://127.0.0.1:8080/item/15/edit
> <type 'exceptions.AttributeError'> at /item/15/edit
> IterBetter instance has no attribute 'id'
> ...
>
> 3Q
>
> On 8月20日, 上午1时53分, "Matteo Zandi" <[EMAIL PROTECTED]> wrote:
> > On 8/12/07, polymath <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > Is there a good way I can make the program do what I want it to?
> >
> > form.Validator("Already in table",
> >     lambda x: len(web.query("SELECT name FROM int_words WHERE name='%s'"
> %
> > x)) == 0)
> > )
> >
> > I use this validator and it works.
> >
> > Matteo
>
>
> >
>


-- 
ashok raavi

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to