diff --git a/webnotes/__init__.py b/webnotes/__init__.py index df30cb4e43..0ddd63d567 100644 --- a/webnotes/__init__.py +++ b/webnotes/__init__.py @@ -22,7 +22,10 @@ local = Local() class _dict(dict): """dict like object that exposes keys as attributes""" def __getattr__(self, key): - return self.get(key) + ret = self.get(key) + if not ret and key.startswith("__"): + raise AttributeError() + return ret def __setattr__(self, key, value): self[key] = value def __getstate__(self): diff --git a/webnotes/boot.py b/webnotes/boot.py index f52cc810ca..10779c7ee4 100644 --- a/webnotes/boot.py +++ b/webnotes/boot.py @@ -69,7 +69,6 @@ def get_bootinfo(): from webnotes.model.utils import compress bootinfo['docs'] = compress(bootinfo['docs']) - # deal with __slots__ in lang if bootinfo.lang: bootinfo.lang = unicode(bootinfo.lang) diff --git a/webnotes/cli.py b/webnotes/cli.py index 88d055c028..a2c2fb9f43 100755 --- a/webnotes/cli.py +++ b/webnotes/cli.py @@ -240,7 +240,6 @@ def use(): @cmd def install(db_name, root_login="root", root_password=None, source_sql=None, admin_password = 'admin', verbose=True, force=False, site_config=None, reinstall=False): - print db_name, source_sql from webnotes.installer import install_db, install_app, make_site_dirs install_db(root_login=root_login, root_password=root_password, db_name=db_name, source_sql=source_sql, admin_password = admin_password, verbose=verbose, force=force, site_config=site_config, reinstall=reinstall) diff --git a/webnotes/model/doc.py b/webnotes/model/doc.py index febd4c5707..fdd4831378 100755 --- a/webnotes/model/doc.py +++ b/webnotes/model/doc.py @@ -178,6 +178,8 @@ class Document: elif self.fields.has_key(name): return self.fields[name] else: + if name.startswith("__"): + raise AttributeError() return '' def get(self, name, value=None): diff --git a/webnotes/webutils.py b/webnotes/webutils.py index 2833b93ee9..919c79b1c4 100644 --- a/webnotes/webutils.py +++ b/webnotes/webutils.py @@ -86,11 +86,13 @@ def build_page(path): def get_context(path): context = None cache_key = "page_context:{}".format(path) + from pickle import dump + from StringIO import StringIO # try from memcache if can_cache(): context = webnotes.cache().get_value(cache_key) - + if not context: context = get_sitemap_options(path) @@ -99,8 +101,7 @@ def get_context(path): context = build_context(context) - if can_cache(context.no_cache): - del context["access"] + if can_cache(context.no_cache): webnotes.cache().set_value(cache_key, context) else: