From 6e525ac424c1dda7e08dba7167133d38d58dd4ce Mon Sep 17 00:00:00 2001 From: Daniel STAN Date: Tue, 14 Jan 2014 20:46:02 +0100 Subject: [PATCH] stats_cableurs2: clean up paths & imports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On utilise /usr/scripts/python.sh en shabang qui rajoute /usr/scripts au PYTHONPATH dès le début. Plus besoin de rajouter plusieurs sous-dossiers à coups de sys.path.append: on référence tous les imports par rapport à ce dossier. --- utils/stats_cableurs2.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/utils/stats_cableurs2.py b/utils/stats_cableurs2.py index 27346efd..e3a332cb 100755 --- a/utils/stats_cableurs2.py +++ b/utils/stats_cableurs2.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/bin/bash /usr/scripts/python.sh # -*- coding: utf-8 -*- # # stats.py @@ -21,17 +21,12 @@ # Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. import sys, re, datetime, string -sys.path.append('/usr/scripts/lc_ldap') - -import lc_ldap - -import shortcuts -sys.path.append("/usr/scripts/gestion/") -from config import ann_scol - -sys.path.append('/usr/scripts/lib') import argparse +from lc_ldap import shortcuts +from gestion.config import ann_scol + + ### Appels à LDAP et tri initial sur l'année en cours db = shortcuts.lc_ldap_readonly() adherents=db.search(u'(&(paiement=%s)(aid=*))' % (ann_scol), sizelimit=2000)