def __init__(self, db=None, config_file=None): if db is None and config_file is None: db = 'Data.fs' config_file = 'site.zcml' if config_file is not None: config(config_file) self.db = database(db)
def zcml_strings(dir, domain="zope", site_zcml=None): """Retrieve all ZCML messages from `dir` that are in the `domain`. """ from zope.app.appsetup import config dirname = os.path.dirname context = config(site_zcml, features=("devmode", ), execute=False) return context.i18n_strings.get(domain, {})
def zcml_strings(path, domain="zope", site_zcml=None): """Retrieve all ZCML messages from `dir` that are in the `domain`. Note, the pot maker runs in a loop for each package and the maker collects only the given messages from such a package by the given path. This allows us to collect messages from eggs and external packages. This also prevents to collect the same message more then one time since we use the same zcml configuration for each package path. """ from zope.app.appsetup import config context = config(site_zcml, features=("devmode",), execute=False) catalog = context.i18n_strings.get(domain, {}) res = {} duplicated = [] append = duplicated.append for msg, locations in catalog.items(): for filename, lineno in locations: # only collect locations based on the given path if filename.startswith(path): id = '%s-%s-%s' % (msg, filename, lineno) # skip duplicated entries if id not in duplicated: append(id) l = res.get(msg, []) l.append((filename, lineno)) res[msg] = l return res
def zcml_strings(dir, domain="zope", site_zcml=None): """Retrieve all ZCML messages from `dir` that are in the `domain`. """ from zope.app.appsetup import config dirname = os.path.dirname context = config(site_zcml, features=("devmode",), execute=False) return context.i18n_strings.get(domain, {})
def zcml_strings(dir, domain="zope", site_zcml=None): """Retrieve all ZCML messages from `dir` that are in the `domain`. """ from zope.app.appsetup import config import zope dirname = os.path.dirname if site_zcml is None: site_zcml = os.path.join(dirname(dirname(dirname(zope.__file__))), "site.zcml") context = config(site_zcml, features=("devmode",), execute=False) return context.i18n_strings.get(domain, {})
def zcml_strings(dir, domain="zope", site_zcml=None): """Retrieve all ZCML messages from `dir` that are in the `domain`. """ from zope.app.appsetup import config import zope dirpath = os.path.dirpath if site_zcml is None: # TODO this assumes a checkout directory structure site_zcml = os.path.join(dirpath(dirpath(dirpath(zope.__file__))), "site.zcml") context = config(site_zcml, features=("devmode", ), execute=False) return context.i18n_strings.get(domain, {})
def setUp(test): # Make sure unit tests are cleaned up setup.placefulSetUp() setup.placefulTearDown() app_module = os.path.dirname(schooltool.app.__file__) c = config(os.path.join(app_module, "ftesting.zcml"))