From 434c0514dc7dd9c7881e1d30db4d988680220af2 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 23 Aug 2008 00:03:29 +0000 Subject: - Read and write a pickled ZCML actions list, stored as ``configure.zcml.pck`` next to the applications's "normal" configuration file. A given bfg app will usually start faster if it's able to read the pickle data. It fails gracefully to reading the real ZCML file if it cannot read the pickle. --- repoze/bfg/path.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 repoze/bfg/path.py (limited to 'repoze/bfg/path.py') diff --git a/repoze/bfg/path.py b/repoze/bfg/path.py new file mode 100644 index 000000000..fcd317fba --- /dev/null +++ b/repoze/bfg/path.py @@ -0,0 +1,15 @@ +import os +import sys + +def caller_path(path, level=2): + if not os.path.isabs(path): + package_globals = sys._getframe(level).f_globals + package_name = package_globals['__name__'] + package = sys.modules[package_name] + prefix = package_path(package) + path = os.path.join(prefix, path) + return path + +def package_path(package): + return os.path.abspath(os.path.dirname(package.__file__)) + -- cgit v1.2.3