Hello!
I wonder if somebody could it confirm:
I have a db:
------- cut --------
db.define_table('guestbook',
Field('email','string',
label=T("E-Mail"),
requires=IS_EMAIL()),
Field('nick','string',
label=T("Nickname"),
requires=IS_NOT_EMPTY()),
Field('ts','datetime',
label=T("Date"),
default=request.now,
writable=False,
readable=False),
Field('text','string',
label=T("Text"),
requires=IS_NOT_EMPTY()),
)
------- cut --------
A controller:
------- cut --------
def flush_cache(form=None):
cache.ram.clear()
def vendegkonyv():
lista=None
if (( auth.user_id==1 ) and (request.vars.r)):
form=SQLFORM(db.guestbook,request.vars.r,deletable=True,onaccept=flush_cache)
else:
form=SQLFORM(db.guestbook,onaccept=flush_cache)
#form=SQLFORM.factory()
if not auth.user_id:
form[0].append(Recaptcha(request,
"...",
"..."))
if form.accepts(request.vars, session):
response.flash = "Record updated"
flush_cache()
elif form.errors:
response.flash = "Error"
flush_cache()
try:
lista=db(db.guestbook.id>0).select(orderby=~db.guestbook.ts,
cache=(cache.ram,120))
except:
pass
return dict(form=form,lista=lista)
------- cut --------
And a view:
------- cut --------
{{extend 'layout.html'}}
<h1>GuestBook</h1>
<div>
{{=form}}
</div>
{{if lista:}}
<table class="vendegkonyv">
<tr>
<th>{{=db.guestbook.ts.label}}</th>
<th>{{=db.guestbook.nick.label}}</th>
<th>{{=db.guestbook.text.label}}</th>
</tr>
{{for elem in lista:}}
<tr>
<td>
{{if (auth.user_id==1):}}
{{=A(elem.ts,_href=URL(r=request,f='vendegkonyv',vars=dict(r=elem.id)))}}
{{else:}}
{{=elem.ts}}
{{pass}}
</td>
<td>{{=elem.nick}}</td>
<td>{{=elem.text}}</td>
</tr>
{{pass}}
</table>
------- cut --------
With the cherrypy isn't a problem but with apache2 and wsgi:
1, I make 3-4 post to the guest book
2, delete them
3, reload the page with a link on page pointing to self to guestbook
I see 0 to 3-4 post on each click randomly which are nonexistent posts
anymore :(
--
You received this message because you are subscribed to the Google Groups
"web2py-users" 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/web2py?hl=en.