diff --git a/intranet/ClassesIntranet/Intranet.py b/intranet/ClassesIntranet/Intranet.py
index 03a9e023..14404bc4 100755
--- a/intranet/ClassesIntranet/Intranet.py
+++ b/intranet/ClassesIntranet/Intranet.py
@@ -29,6 +29,7 @@ import cherrypy, os, sys
make_path = os.path.join
import crans.utils.exceptions
from ClassesIntranet.AuthorisationsManager import setDroits
+from crans.mail import quickSend
class Intranet:
# ######################################################## #
@@ -43,28 +44,24 @@ class Intranet:
def loadModule(self, un_module):
MODULES_DIR = cherrypy.config.get("crans.modules.dir")
- if not un_module.startswith("."):
+ if not (un_module.startswith(".") or un_module.startswith("_")):
# faire ici l'importation
# importer le fichier main.py
try:
#module_path = MODULES_DIR + un_module + "/main"
module_path = make_path(un_module, "main")
+ # import n'aime pas les chemins absolus !!
mon_module = __import__(module_path)
module_root = mon_module.main()
# on ajoute la classe a l'arborescence de cherrypy :
setattr( self, un_module, module_root)
- # on ajoute le module aux modules connus :
try:
+ # on ajoute le module aux modules connus
cat = module_root.category()
if not self._loaded_modules.has_key(cat):
- self._loaded_modules[cat] = {}
+ self._loaded_modules[cat] = {}
self._loaded_modules[cat][un_module] = module_root
- except:
- if cherrypy.config.get("server.environment") == "development":
- _crans_cp.log("Impossible d'obtenir les parametres du module %s" % un_module)
- _crans_cp.log(crans.utils.exceptions.formatExc())
- # on ajoute les droits du module :
- try:
+ # on ajoute les droits du module :
droits_module = module_root.droits()
setDroits("/%s" % un_module, droits_module)
except:
@@ -202,7 +199,7 @@ Ceci est un rapport de bug envoye par l'intranet.
test.exposed = True
def _cp_on_http_error(self, status, message):
- if (cherrypy.config.configMap["global"]["server.environment"] == "development"):
+ if (cherrypy.config.configMap["global"]["server.environment"] == "development") or 1:
cherrypy._cputil._cp_on_http_error(status, message)
return
if status==403:
@@ -220,7 +217,7 @@ Ceci est un rapport de bug envoye par l'intranet.
elif status==500:
self.send_error_repport(status = status, message = message )
# les filtres ne sont pas appliqués, on le fait àla main...
- from plugins.templatesfilter import TemplatesFilter
+ from TemplatesManager import TemplatesFilter
TemplatesFilter().goWithThisDict({'template':'error', 'values':{'status':status, 'message':message }})
else:
self.send_error_repport(status = status, message = message)
diff --git a/intranet/ClassesIntranet/ModuleBase.py b/intranet/ClassesIntranet/ModuleBase.py
index d69f4cca..01006eac 100644
--- a/intranet/ClassesIntranet/ModuleBase.py
+++ b/intranet/ClassesIntranet/ModuleBase.py
@@ -11,6 +11,7 @@ class ModuleBase:
_droits = []
_club = False
+ _adh = True
def droits(self):
return self._droits
@@ -18,5 +19,8 @@ class ModuleBase:
if cherrypy.session['estClub'] == True:
if self._club == False:
return False
+ else:
+ if self._adh == False:
+ return False
return verifDroits(cherrypy.session['droits'], self.droits())
diff --git a/intranet/ClassesIntranet/TemplatesManager.py b/intranet/ClassesIntranet/TemplatesManager.py
index 4d7934c0..4c742d67 100644
--- a/intranet/ClassesIntranet/TemplatesManager.py
+++ b/intranet/ClassesIntranet/TemplatesManager.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
from cherrypy.filters.basefilter import BaseFilter
import cherrypy, os
from Cheetah.Template import Template
@@ -84,7 +85,7 @@ class TemplatesFilter(BaseFilter):
except:
t = Template(file='main.tmpl', searchList=[body,{'login':''},values])
- return str(t)
+ return t.__str__()
def goWithThisDict(self, aDict):
body = aDict
@@ -93,13 +94,13 @@ class TemplatesFilter(BaseFilter):
templatevalues = self._getBodyNameSpace(body)
defaultvalues = {'static':self._getCorrectStaticMethod()}
t = Template(file=bodyTemplate, searchList=[templatevalues, defaultvalues])
- body['page'] = str(t)
+ body['page'] = t.__str__()
if not self._isStandaloneBody(body):
body = self._useMainTemplate(body)
else:
body = body["page"]
- cherrypy.response.body = body
+ cherrypy.response.body = body.encode("utf8")
def beforeFinalize(self):
diff --git a/intranet/ClassesIntranet/__init__.py b/intranet/ClassesIntranet/__init__.py
index a75f95cd..9e1c3e77 100644
--- a/intranet/ClassesIntranet/__init__.py
+++ b/intranet/ClassesIntranet/__init__.py
@@ -3,6 +3,6 @@ import cherrypy
def current_module():
current_path = cherrypy.request.object_path
module_name = current_path.split('/')[1]
- if module_name != 'index':
+ if module_name not in ['index', 'send_error_repport']:
return module_name
return None
diff --git a/intranet/Root.py b/intranet/Root.py
index 77137b06..4e66fa86 100755
--- a/intranet/Root.py
+++ b/intranet/Root.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# -*- coding: iso-8859-15 -*-
+# -*- coding: utf-8 -*-
# #############################################################
# ..
# .... ............ ........
@@ -72,10 +72,11 @@ if (options.port):
# import du CransLdap qu'il va bien (on utilise CransLdap et non crans_ldap car on veut
# forcer l'ouverture d'une nouvelle connexion à chaque login)
-if (cherrypy.config.configMap["global"]["server.environment"] == "development"):
- from ldap_crans_test import CransLdap
-else:
- from ldap_crans import CransLdap
+#if (cherrypy.config.configMap["global"]["server.environment"] == "development"):
+# from ldap_crans_test import CransLdap
+#else:
+# from ldap_crans import CransLdap
+from ldap_crans import CransLdap
sys.path.append(cherrypy.config.get('rootDir'))
# ######################################################## #
diff --git a/intranet/templates/login.tmpl b/intranet/templates/login.tmpl
index 62ccc493..31f12791 100644
--- a/intranet/templates/login.tmpl
+++ b/intranet/templates/login.tmpl
@@ -78,7 +78,7 @@
-
+