From 98efb1f8747709d34693c31a1b9e966c054e5be6 Mon Sep 17 00:00:00 2001 From: gi0baro Date: Sun, 25 Jan 2015 02:16:08 +0100 Subject: [PATCH] Added a warn message when pydal isn't available --- gluon/__init__.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/gluon/__init__.py b/gluon/__init__.py index 588c3e28..caf3d0a9 100644 --- a/gluon/__init__.py +++ b/gluon/__init__.py @@ -15,10 +15,20 @@ __all__ = ['A', 'B', 'BEAUTIFY', 'BODY', 'BR', 'CAT', 'CENTER', 'CLEANUP', 'CODE #: add pydal to sys.modules import os import sys -sys.path.append(os.path.join( - os.path.dirname(os.path.abspath(__file__)), "packages", "dal")) -import pydal -sys.modules['pydal'] = pydal +try: + sys.path.append(os.path.join( + os.path.dirname(os.path.abspath(__file__)), "packages", "dal")) + import pydal + sys.modules['pydal'] = pydal +except: + raise RuntimeError( + "Seems that you haven't pydal inside your web2py's copy. We are sorry" + + " for the inconvenience.\nIf you cloned the repository without " + + "'--recursive' option, please run 'git submodule update' inside your " + + "web2py copy.\nIf you downloaded the package from github with the " + + "download button, please download a released copy from " + + "http://www.web2py.com or one attached to the releases on github." + ) from globals import current from html import *