OOo.... :'(
may be you are right...
item = web.select('todo', where='id=$id', vars=locals())[0] #,
_test=True
# item = web.query('select * from todo where id=$id', vars=locals())
# print render.error(item.created)
# return False
render.edit(item)
i return the item.title and item.created, it is ok
but in edit.html, it not works
...
<input type="text" name="title" value="$item.title" />
...
when i brower http://127.0.0.1:8080/item/15/edit
this page is blank, it is nothing... blank page..
why do it?
thank you.
On 10/6/07, 大郎 <[EMAIL PROTECTED]> wrote:
>
> item = web.select('todo', where='id=$id', vars=locals(),
> > _test=True)[0]
> > print render.error(item)
> >
>
> returns the sql is: SELECT * FROM todo WHERE id=%s
>
> item = web.select('todo', where='id=$id', vars=locals(),
> > _test=True) # [0]
> > print render.error(item)
> >
>
> returns the sql is: SELECT * FROM todo WHERE id=15
>
> maybe it do not like that... ?
>
> On 10/6/07, ashok raavi <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > On 10/6/07, 大郎 <[EMAIL PROTECTED] > wrote:
> > >
> > > hi, when I change like this as you said:
> > >
> > > item = web.select('todo', where='id=$id', vars=locals())[0] #,
> > > _test=True)
> >
> >
> > this returns the first row of your query result.
> >
> > print render.error(len(list(item)))
> > > return False
> > >
> > > it returns 4 :'(
> >
> >
> > that means your table is having 4 column's , what's wrong with that?
> >
> > when I do not catch this results
> > > and this page is blank...
> >
> >
> > what is the content of your error html ??
> >
> > On 10/6/07, ashok raavi < [EMAIL PROTECTED]> wrote:
> > >
> > > >
> > > >
> > > > 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
> > > >
> > > >
> > >
> > >
> > > --
> > > 我走到一个陌生的地方, 告诉别人 我要去流浪
> > > 哦,我要去疗伤……
> > >
> > > Gtalk: iexper(at)gmail.com
> > >
> > >
> >
> >
> > --
> > ashok raavi
> > > >
> >
>
>
> --
> 我走到一个陌生的地方, 告诉别人 我要去流浪
> 哦,我要去疗伤……
>
> Gtalk: iexper(at)gmail.com
>
--
每个人都有一片属于自己的森林, 迷失的消失了, 相逢的还会再相逢...
Gtalk : iexper(at)gmail.com
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---