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

Add a shorthand for pattern/URL settings to ConfigContainer #3724

Open
The-Compiler opened this issue Mar 15, 2018 · 0 comments
Open

Add a shorthand for pattern/URL settings to ConfigContainer #3724

The-Compiler opened this issue Mar 15, 2018 · 0 comments
Labels
component: config Issues related to configuration. component: style / refactoring Issues related to coding styles or code that should be refactored. priority: 3 - wishlist Issues which are not important and/or where it's unclear whether they're feasible.

Comments

@The-Compiler
Copy link
Member

Currently, there are two ways to set settings for an URL:

config.set('content.images', False, '*://example.com/')
with config.pattern('*://example.com/') as p:
    p.content.images = False

And in qutebrowser code, there's config.instance.get_obj(..., url=...) and config.instance.get_obj_for_pattern(..., url=...).

I've been discussing with @toofar about possible alternatives which would make both easier (and more consistent with the shorthand for global settings). So far, two things came to mind:

  • Having subscripts on ConfigContainer - in config.py: c[pattern].content.images = False; config.val[url].content.images`. However, that can't tell URL/pattern apart and might be a bit much magic.
  • Having url(...) and pattern(...) methods on ConfigContainer: c.pattern(...).content.images = False and config.val.url(...).content.images (or maybe for_url and for_pattern).

Not sure yet about what to do (if anything at all) and what'd happen with the old syntax - just leaving this here as some food for thought.

@The-Compiler The-Compiler added component: style / refactoring Issues related to coding styles or code that should be refactored. component: config Issues related to configuration. priority: 3 - wishlist Issues which are not important and/or where it's unclear whether they're feasible. labels Mar 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: config Issues related to configuration. component: style / refactoring Issues related to coding styles or code that should be refactored. priority: 3 - wishlist Issues which are not important and/or where it's unclear whether they're feasible.
Projects
None yet
Development

No branches or pull requests

1 participant