why the slow sqlform

34 views
Skip to first unread message

Maurice Waka

unread,
Jun 15, 2018, 4:36:42 PM6/15/18
to web2py-users
My code shown below:

Controller:
def views():
    row
= db(db.post.author== auth.user.id).select(db.post.id, db.post.message, orderby=~db.post.id, limitby=(0,1)).first()
    messages
= row.message if row else None
    morecode
...


View.html:

<body>
       
<div class="chat_window">
       
<ul class="messages">
        {{for reply in replies:}}
       
<li class="message left appeared">
       
<div>
        {{=prettydate(reply.modified_on)}}
       
</div>
       
<div class="text_wrapper">
       
<div class="text">{{=XML(reply.quest, sanitize=True)}}</div>
       
</div>
       
</li>
       
<li class="message right appeared">
       
<div>
        {{=prettydate(reply.modified_on)}}
       
</div>
       
<div class="text_wrapper">
       
<div class="text">{{=XML(reply.message, sanitize=True)}}</div>
       
</div>
       
</li>
        {{pass}}
       
</ul>
       
<div class="bottom_wrapper clearfix">
       
<div class="message_input_wrapper">
       
<div class="message_input_wrapper">
        {{=form.custom.begin}}
       
<textarea name="message" id="message_input" placeholder="Type your message here..."></textarea>
       
<button>send</button>
        {{=form.custom.end}}
       
</div>
       
</div>
       
</div>
       
</div>
       
<div class="message_template">
       
<li class="message">
       
<div class="message-data-time" ></div>
       
<div class="text_wrapper">
       
<div class="text"></div>
       
</div>
       
</li>
       
</div>
   
</body>

I note that It takes some time before an item is posted to the post table. Is there a problem with custom form, is there a better way of working this out?
Regards

Leonel Câmara

unread,
Jun 16, 2018, 3:28:04 PM6/16/18
to web2py-users
I don't see anything there that would make things terribly slow. It's probably related to some other code we aren't seeing (maybe even in the models).

Maurice Waka

unread,
Jun 16, 2018, 5:10:20 PM6/16/18
to web...@googlegroups.com
Thanks.
I'll review 

On Sat, 16 Jun 2018, 22:28 Leonel Câmara <leonel...@gmail.com> wrote:
I don't see anything there that would make things terribly slow. It's probably related to some other code we aren't seeing (maybe even in the models).

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/ydmllZEr2MQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages