Loading time optimised

Now the Database is queried instead of bugzilla. Bugzilla is only queried when the code is run in cron mode. This improves the load time of the page. Please do have a look. 

Thank you.
nit: in python we don't use () as much unless we have more than one condition.