Forum Home
Welcome to the new pyForum.org.
A message board system written in pure python using the web2py framework.
pyForum is sporting a new, completely re-designed interface and back-end
Download pyForum from https://bitbucket.org/speedbird/pyforum
Optimisation of 1st run prepopulate
By: francisboon
Rank: Starfleet Ensign
Postings: 7
From: Unknown
Posted: Mon, 21 November, 2011 - 07:42 AM

I see that models/db.py has a bunch of checks to ensure that the relevant startup data is loaded into the database:
https://bitbucket.org/speedbird/pyforum/src/654855c9cc71/models/db.py#cl-225


(1) Doing a select(table.id, limitby=(0, 1)).first() is faster than a .count()

(2) Better to wrap all these behind a single check for a value which can be set at the top of the file? (like 'migrate')

You can see how I do this here:
http://bazaar.launchpad.net/~flavour/sahana-eden/trunk/view/head:/models/zzz_1st_roles.py

http://bazaar.launchpad.net/~flavour/sahana-eden/trunk/view/head:/models/zzz_1st_run.py

F

This topic contains no responses.

Welcome
System Announcements
Latest Posts
Support pyForum