Rsoltion de quelques problmes avec les chemins
darcs-hash:20070124131613-f46e9-4668b5a746f18078e9690c55080f63d20bb5591a.gz
This commit is contained in:
parent
9ca4c1ea99
commit
b59ce5e610
1 changed files with 10 additions and 7 deletions
|
@ -25,7 +25,8 @@
|
|||
# Copyright (c) 2006 by www.crans.org
|
||||
# #############################################################
|
||||
import crans.cp as _crans_cp
|
||||
import cherrypy, os
|
||||
import cherrypy, os, sys
|
||||
make_path = os.path.join
|
||||
import crans.utils.exceptions
|
||||
from ClassesIntranet.AuthorisationsManager import setDroits
|
||||
|
||||
|
@ -38,7 +39,7 @@ class Intranet:
|
|||
_loaded_modules = {}
|
||||
|
||||
def _make_static_path_for_module(self, module_name ):
|
||||
return "/" + module_name + "/static"
|
||||
return make_path("/", module_name, "static")
|
||||
|
||||
def loadModule(self, un_module):
|
||||
MODULES_DIR = cherrypy.config.get("crans.modules.dir")
|
||||
|
@ -46,7 +47,8 @@ class Intranet:
|
|||
# faire ici l'importation
|
||||
# importer le fichier main.py
|
||||
try:
|
||||
module_path = MODULES_DIR + "/" + un_module + "/main"
|
||||
#module_path = MODULES_DIR + un_module + "/main"
|
||||
module_path = make_path(un_module, "main")
|
||||
mon_module = __import__(module_path)
|
||||
module_root = mon_module.main()
|
||||
# on ajoute la classe a l'arborescence de cherrypy :
|
||||
|
@ -71,10 +73,9 @@ class Intranet:
|
|||
_crans_cp.log(crans.utils.exceptions.formatExc())
|
||||
except:
|
||||
_crans_cp.log("Impossible de charger le module %s" % un_module)
|
||||
if cherrypy.config.get("server.environment") == "development":
|
||||
_crans_cp.log(crans.utils.exceptions.formatExc())
|
||||
_crans_cp.log(crans.utils.exceptions.formatExc())
|
||||
# ajouter le dossier static ou il faut
|
||||
staticPath = cherrypy.config.get("rootDir") + "/" + MODULES_DIR + "/" + un_module + "/static"
|
||||
staticPath = make_path(MODULES_DIR, un_module, "static")
|
||||
if os.path.isdir(staticPath):
|
||||
settings= { self._make_static_path_for_module(un_module):
|
||||
{ 'sessionAuthenticateFilter.on': False,
|
||||
|
@ -97,9 +98,11 @@ class Intranet:
|
|||
MODULES_DIR = cherrypy.config.get("crans.modules.dir", False)
|
||||
if MODULES_DIR:
|
||||
if os.path.isdir(MODULES_DIR):
|
||||
sys.path.append(MODULES_DIR)
|
||||
Liste_Modules = os.listdir(MODULES_DIR)
|
||||
for un_module in Liste_Modules:
|
||||
self.loadModule(un_module)
|
||||
if un_module != "CVS":
|
||||
self.loadModule(un_module)
|
||||
else:
|
||||
_crans_cp.log("Dossier des modules invalide", 'LOADING', 2)
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue