Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defer config.add_translation_dirs and push/pop threadlocals during deferred actions/discriminators #2873

Merged
merged 4 commits into from
Dec 21, 2016

Conversation

mmerickel
Copy link
Member

This resolves #2046.

  1. Added docs about importance of config.begin() when invoking add_translation_dirs.

  2. Deferred the computation of the specs until the default config phase in order to allow asset overrides defined later to have an effect.

  3. Used the AssetResolver to resolve the entire spec instead of just the package name such that translation directories can override each other even if they don't have the same name / subpath.

  4. config.override_asset now occurs in an earlier config phase to ensure assets are updated prior to add_translation_dirs executing.

I would appreciate it if @piotr-dobrogost could review this.

@mmerickel mmerickel added this to the 1.8 milestone Dec 16, 2016
@mmerickel mmerickel force-pushed the defer-translation-dirs branch from efe34f8 to 6a4168b Compare December 16, 2016 06:38
@mmerickel
Copy link
Member Author

I will amend this PR tonight to have add_translation_dirs call begin and end itself during the register cycle allowing it to do what it needs to do properly. This will remove the new docs added.

@mmerickel mmerickel force-pushed the defer-translation-dirs branch from 6a4168b to e38c247 Compare December 17, 2016 02:24
@mmerickel mmerickel force-pushed the defer-translation-dirs branch from e38c247 to 0c1c587 Compare December 17, 2016 02:28
mmerickel added a commit to mmerickel/pyramid that referenced this pull request Dec 17, 2016
@mmerickel
Copy link
Member Author

Ok I upped the ante and am now calling begin/end during every commit cycle so any deferred action can depend on threadlocals. I think this makes a lot of sense.

This is ready for review.

@mmerickel mmerickel force-pushed the defer-translation-dirs branch from 90ad0c4 to 9c2c864 Compare December 17, 2016 20:35
mmerickel added a commit to mmerickel/pyramid that referenced this pull request Dec 17, 2016
@mmerickel
Copy link
Member Author

mmerickel commented Dec 20, 2016

I'm going to merge this tonight unless someone reviews it by then and has an issue. It has global changes to the configurator so I was hoping there might be a review, but I've also added enough tests that I'm pretty confident in it.

@digitalresistor digitalresistor self-requested a review December 20, 2016 22:24
@digitalresistor
Copy link
Member

Will review tonight.

Copy link
Member

@digitalresistor digitalresistor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.


- Asset specifications for directories passed to
``config.add_translation_dirs`` now support overriding the entire asset
specification, including the folder name. Previously on the package name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/on/only/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks

intr['spec'] = spec
introspectables.append(intr)
directories.append(directory)
resolver = AssetResolver(self.package_name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup!

@mmerickel mmerickel force-pushed the defer-translation-dirs branch from 9c2c864 to 5f4649e Compare December 21, 2016 16:26
@mmerickel mmerickel merged commit 721d1b0 into Pylons:master Dec 21, 2016
@piotr-dobrogost
Copy link

piotr-dobrogost commented Dec 21, 2016

Looks good. Thank you for fixing this.

Ok I upped the ante and am now calling begin/end during every commit cycle so any deferred action can depend on threadlocals.

It would be good to make title for this pull reflect broader scope of the change.

@mmerickel mmerickel changed the title defer config.add_translation_dirs defer config.add_translation_dirs and push/pop threadlocals during deferred actions/discriminators Dec 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document interaction of .override_asset() with .add_translation_dirs() and others
3 participants