From 4b8a1f423347c5d2af3238d3117cf2aea3ef4b1d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Larchev=C3=AAque?= Date: Fri, 24 Feb 2012 14:52:21 -0500 Subject: [PATCH] 1.4 namespace ref --- CHANGES | 7 +++++++ auf/__init__.py | 6 +----- auf/django/__init__.py | 6 +----- auf/django/skin/context_processors.py | 20 +++++++++++++------- setup.py | 4 ++-- 5 files changed, 24 insertions(+), 19 deletions(-) diff --git a/CHANGES b/CHANGES index 721cc3d..2206bf0 100755 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,10 @@ +1.4 +--- + +* fix namespace + +* auf.django.references optionnel + 1.3 --- diff --git a/auf/__init__.py b/auf/__init__.py index 35cf25b..de40ea7 100755 --- a/auf/__init__.py +++ b/auf/__init__.py @@ -1,5 +1 @@ -try: - __import__('pkg_resources').declare_namespace(__name__) -except: - # bootstrapping - pass +__import__('pkg_resources').declare_namespace(__name__) diff --git a/auf/django/__init__.py b/auf/django/__init__.py index 35cf25b..de40ea7 100755 --- a/auf/django/__init__.py +++ b/auf/django/__init__.py @@ -1,5 +1 @@ -try: - __import__('pkg_resources').declare_namespace(__name__) -except: - # bootstrapping - pass +__import__('pkg_resources').declare_namespace(__name__) diff --git a/auf/django/skin/context_processors.py b/auf/django/skin/context_processors.py index 08a1688..53880a9 100755 --- a/auf/django/skin/context_processors.py +++ b/auf/django/skin/context_processors.py @@ -1,6 +1,10 @@ # -*- encoding: utf-8 -*- -from auf.django.references import models as ref +try: + from auf.django.references import models as ref +except: + ref = None + from django.conf import settings PROJET_TITRE_KEY = 'PROJET_TITRE' @@ -14,12 +18,14 @@ def auf(request): site = "Créer une clef '%s' dans settings.py" % PROJET_TITRE_KEY # le User peut changer de mdp s'il est local - try: - email = request.user.email - can_change_password = not ref.Authentification.objects.filter(courriel=email).exists() - except: - can_change_password = None - + if ref is not None: + try: + email = request.user.email + can_change_password = not ref.Authentification.objects.filter(courriel=email).exists() + except: + can_change_password = None + else: + can_change_password = True return { 'AUF_SITE' : site, 'can_change_password' : can_change_password, diff --git a/setup.py b/setup.py index a15deec..38d6d92 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup, find_packages import sys, os name = 'auf.django.skin' -version = '1.3' +version = '1.4' setup(name=name, version=version, @@ -17,7 +17,7 @@ setup(name=name, author_email='olivier.larcheveque@auf.org', url='http://pypi.auf.org/%s' % name, license='GPL', - namespace_packages = ['auf'], + namespace_packages = ['auf', 'auf.django', ], packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), include_package_data=True, zip_safe=False, -- 1.7.10.4