diff --git a/intranet/modules/quota/main.py b/intranet/modules/quota/main.py index 104a1ec8..a65e3b4b 100644 --- a/intranet/modules/quota/main.py +++ b/intranet/modules/quota/main.py @@ -12,24 +12,26 @@ class main(ModuleBase): def title(self): return "Quotas" def icon(self): - quotas = self._get_quota() - for a_quota in quotas: - if a_quota['quota'] < a_quota['usage']: - return "icon_alert.png" - return "icon.png" + try: + quotas = self._get_quota() + for a_quota in quotas: + if a_quota['quota'] < a_quota['usage']: + return "icon_alert.png" + return "icon.png" + except: + return "icon_disabled.png" def _get_quota(self): - if (cherrypy.config.configMap["global"]["server.environment"] == "development"): + if (cherrypy.config.configMap["global"]["server.environment"] == "development"): return quota.fake_getUserQuota(cherrypy.session['uid']) else: return quota.getUserQuota(cherrypy.session['uid']) - ########################## # affichage ########################## - # + # # methode qui affiche la template # def index(self ): @@ -68,24 +70,24 @@ class main(ModuleBase): except Exception, e: crans.cp.log('error getting quota for user %s : %s' % (cherrypy.session['uid'], str(e)), 'QUOTA', 1) values = {'erreur':str(e)} - return {'template':'quota', + return {'template':'quota', 'values': values, 'stylesheets':['quota.css'], 'scripts':['quota.js', 'popup.js'], } index.exposed = True - + def index_html(self ): result = self.index() result['template'] = 'quota_html' return result index_html.exposed = True - - + + ########################## # SVG ########################## - # + # # methode qui renvoie une barre en svg # def barreSVG(self, filesystem = ""): @@ -103,7 +105,7 @@ class main(ModuleBase): except Exception, e: values = {'erreur':str(e) } cherrypy.response.headers['Content-Type']="image/svg+xml" - return {'template':'barre.svg', + return {'template':'barre.svg', 'values': values, 'standalone':True, }