About response.toolbar

52 views
Skip to first unread message

Константин Комков

unread,
Oct 15, 2019, 2:52:06 AM10/15/19
to web2py-users
What I see on picture? What is that queries?
Are there way to put toolbar buttons in string?

Thank you.
1.png

Massimo Di Pierro

unread,
Oct 16, 2019, 2:39:59 AM10/16/19
to web2py-users
Those are queries made by your app to the database within the same request that serves the toolbar. This looks like a registration page because of INSERT in auth_user. It does make a lot of select. you may want to simplify your code and use caching, else this page is going to be very slow.

I do not understand your last question.

Константин Комков

unread,
Oct 16, 2019, 3:29:16 AM10/16/19
to web2py-users
That page loads very fast. All that queries (more then 100) don't execute on one pages, therefore I asked what is thats queries. All of them contains in my app but in different functions. I use cache for first 8 queries like that:
if not 'edu_lvl' in globals():
   
def getConst():
        edu_lvl
= {rec.id:rec.name for rec in db(db.s_edu_level).select(db.s_edu_level.id,db.s_edu_level.name)}
        edu_inst
={rec.id:rec.name for rec in db(db.s_edu_inst).select(db.s_edu_inst.id,db.s_edu_inst.name)}
        hostel
={rec.id:rec.name for rec in db(db.s_hostel).select(db.s_hostel.id,db.s_hostel.name)}
        medal
={rec.id:rec.name for rec in db(db.s_medal).select(db.s_medal.id,db.s_medal.name)}
        region
={rec.id:rec.name for rec in db(db.s_region).select(db.s_region.id,db.s_region.name)}
        country
={rec.id:rec.name for rec in db(db.s_country).select(db.s_country.id,db.s_country.name)}
        kladr_type
={rec.id:rec.name for rec in db(db.s_kladr_loc_type).select(db.s_kladr_loc_type.id,db.s_kladr_loc_type.name)}
        vuzName
=db(db.t_const.name == 'VUZ_KR').select(db.t_const.text).first()
       
return edu_lvl,edu_inst,hostel,medal,region,country,kladr_type,vuzName

    edu_lvl
,edu_inst,hostel,medal,region,country,kladr_type,vuzName = cache.ram('consts', lambda: getConst(), time_expire=60*60*24)
Moreover that queries belong different users. It's reason why quantity of them more then 100. I thought that it's queries for period of time.
About my last questions, I wanted to write: are there way to put buttons in row like on picture.
1.png

Константин Комков

unread,
Oct 22, 2019, 5:01:53 AM10/22/19
to web2py-users
Massimo Di Pierro, please, told about db stats or where I can find file for check it myself.
Reply all
Reply to author
Forward
0 new messages