Skip to content

Instantly share code, notes, and snippets.

@piotr-dobrogost
Created November 5, 2015 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piotr-dobrogost/4bdbefa6a74dbdcada82 to your computer and use it in GitHub Desktop.
Save piotr-dobrogost/4bdbefa6a74dbdcada82 to your computer and use it in GitHub Desktop.
Interaction between overrides and translations in Pyramid – trying to reproduce behavior (error) seen in project based on Kotti
def includeme(config):
config.add_translation_dirs('app:locale')
config.add_translation_dirs('app:framework-locale')
config.commit()
config.scan(__name__)
from pyramid.config import Configurator
def configure():
config = Configurator()
config.include('framework')
config.commit()
config.include('app')
config.add_translation_dirs('framework:locale')
def includeme(config):
config.override_asset('framework', 'app:framework-overrides/')
configure()
Traceback (most recent call last):
File "/home/piotr/apps/pycharm-4.5.3/helpers/pydev/pydevd.py", line 2358, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "/home/piotr/apps/pycharm-4.5.3/helpers/pydev/pydevd.py", line 1778, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/piotr/projects/pyramid/repro/framework/__init__.py", line 18, in <module>
configure()
File "/home/piotr/projects/pyramid/repro/framework/__init__.py", line 8, in configure
config.include('framework')
File "/home/piotr/projects/pyramid/pyramid/config/__init__.py", line 769, in include
c = self.maybe_dotted(callable)
File "/home/piotr/projects/pyramid/pyramid/config/__init__.py", line 869, in maybe_dotted
return self.name_resolver.maybe_resolve(dotted)
File "/home/piotr/projects/pyramid/pyramid/path.py", line 320, in maybe_resolve
return self._resolve(dotted, package)
File "/home/piotr/projects/pyramid/pyramid/path.py", line 327, in _resolve
return self._zope_dottedname_style(dotted, package)
File "/home/piotr/projects/pyramid/pyramid/path.py", line 376, in _zope_dottedname_style
found = __import__(used)
File "/home/piotr/projects/pyramid/repro/framework/__init__.py", line 18, in <module>
configure()
File "/home/piotr/projects/pyramid/repro/framework/__init__.py", line 10, in configure
config.include('app')
File "/home/piotr/projects/pyramid/pyramid/config/__init__.py", line 798, in include
c(configurator)
File "/home/piotr/projects/pyramid/repro/app/__init__.py", line 3, in includeme
config.add_translation_dirs('app:locale')
File "/home/piotr/projects/pyramid/pyramid/util.py", line 570, in wrapper
result = wrapped(self, *arg, **kw)
File "/home/piotr/projects/pyramid/pyramid/config/i18n.py", line 87, in add_translation_dirs
directory)
pyramid.exceptions.ConfigurationError: "/home/piotr/projects/pyramid/repro/app/locale" is not a directory
app
├── framework-overrides
├── __init__.py
framework
├── __init__.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment