From c7074d5e4d7b0ed16b9e06c28a31ac75ce77874e Mon Sep 17 00:00:00 2001 From: mdipierro Date: Mon, 20 Aug 2012 16:02:11 -0500 Subject: [PATCH] better web2py.py thanks Niphlod --- VERSION | 2 +- gluon/storage.py | 2 +- web2py.py | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index 0e4e09a1..b6f16910 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.00.0 (2012-08-20 12:04:52) dev +Version 2.00.0 (2012-08-20 16:02:06) dev diff --git a/gluon/storage.py b/gluon/storage.py index f556f1a1..7682f9ed 100644 --- a/gluon/storage.py +++ b/gluon/storage.py @@ -51,7 +51,6 @@ class List(list): return value class Storage(object): - __class__ = dict """ A Storage object is like a dictionary except `obj.foo` can be used in addition to `obj['foo']`, and setting obj.foo = None deletes item foo. @@ -72,6 +71,7 @@ class Storage(object): None """ + __class__ = dict def __init__(self, __d__=None, **values): self.__dict__.update(__d__ or {},**values) diff --git a/web2py.py b/web2py.py index 623be32f..3446da0a 100755 --- a/web2py.py +++ b/web2py.py @@ -4,11 +4,13 @@ import os import sys -if getattr(sys, 'frozen', None): - path = os.getcwd() # Seems necessary for py2exe -else: +if '__file__' in globals(): path = os.path.dirname(os.path.abspath(__file__)) - os.chdir(path) +elif hasattr(sys, 'frozen'): + path = os.path.dirname(os.path.abspath(sys.executable)) # for py2exe +else: #should never happen + path = os.getcwd() +os.chdir(path) sys.path = [path]+[p for p in sys.path if not p==path]