summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-02-19Merge pull request #1587 from msabramo/fix_asset_override_with_packageMichael Merickel
Fix asset override with package
2015-02-19Fix asset override with packageMarc Abramowitz
`AssetsConfiguratorMixin.override_asset` does: ```python __import__(override_package) to_package = sys.modules[override_package] override_source = PackageAssetSource(to_package, override_prefix) ``` so it's assuming that the `package` argument to `PackageAssetSource.__init__` takes a module object. But then `PackageAssetSource` had a bunch of methods that did stuff like: - `pkg_resources.resource_exists(self.package, path)` - `pkg_resources.resource_filename(self.package, path)` - `pkg_resources.resource_stream(self.package, path)` and all these `pkg_resources` functions need their `package_or_requirement` argument to be a **string**; not a module - see https://pythonhosted.org/setuptools/pkg_resources.html#basic-resource-access, which says: > the `package_or_requirement argument` may be either a Python package/module > name (e.g. `foo.bar`) or a `Requirement` instance. This causes errors when overriding assets -- e.g.: I am using Kotti and Kotti has this code (https://github.com/Kotti/Kotti/blob/master/kotti/__init__.py#L251): ```python for override in [a.strip() for a in settings['kotti.asset_overrides'].split() if a.strip()]: config.override_asset(to_override='kotti', override_with=override) ``` A Kotti add-on called kotti_navigation does this (https://github.com/Kotti/kotti_navigation/blob/master/kotti_navigation/__init__.py#L12): ```python settings['kotti.asset_overrides'] += ' kotti_navigation:kotti-overrides/' ``` The above code is all legit as far as I can tell and it works fine in pyramid 1.5.2, but it fails with pyramid master with the following: ```pytb File "/Users/marca/python/virtualenvs/kotti_inventorysvc/lib/python2.7/site-packages/pkg_resources.py", line 959, in resource_filename self, resource_name File "/Users/marca/dev/git-repos/pyramid/pyramid/config/assets.py", line 31, in get_resource_filename filename = overrides.get_filename(resource_name) File "/Users/marca/dev/git-repos/pyramid/pyramid/config/assets.py", line 125, in get_filename result = source.get_filename(path) File "/Users/marca/dev/git-repos/pyramid/pyramid/config/assets.py", line 224, in get_filename if pkg_resources.resource_exists(self.package, path): File "/Users/marca/python/virtualenvs/kotti_inventorysvc/lib/python2.7/site-packages/pkg_resources.py", line 948, in resource_exists return get_provider(package_or_requirement).has_resource(resource_name) File "/Users/marca/python/virtualenvs/kotti_inventorysvc/lib/python2.7/site-packages/pkg_resources.py", line 225, in get_provider __import__(moduleOrReq) TypeError: __import__() argument 1 must be string, not module ``` This was a little tricky to resolve because the `override_asset` function wants to pass a module object to `PackageAssetSource.__init__`, but there are a number of tests in `pyramid/tests/test_config/test_assets.py` that assume that it takes a string. So I ended up making it legal to pass either one, so that I don't have to change as much calling code. See https://github.com/Kotti/kotti_navigation/issues/13
2015-02-19Enhance test_assets to expose #1580Marc Abramowitz
This enhances existing tests so that they detect the issue in #1580. Then I'm going to fix the issue in PR #1587. See #1580
2015-02-17pserve -b will always open 127.0.0.1Michael Merickel
2015-02-17enhance security docs with an example of subclassing a builtin policyMichael Merickel
2015-02-17grammarMichael Merickel
2015-02-17Merge branch 'pull.1483'Michael Merickel
2015-02-17reword a small part to clarify what's happening with view_configMichael Merickel
2015-02-17Merge branch 'fix.600' of zmarvel/pyramid into pull.1483Michael Merickel
2015-02-17fix typo on changes.rstMichael Merickel
2015-02-17Merge branch 'feature.re-entrant-config'Chris McDonough
2015-02-17appease coverageChris McDonough
2015-02-17dammit, forgot to revert importMichael Merickel
2015-02-17add functest for config reentrancyChris McDonough
2015-02-17fix syntaxMichael Merickel
2015-02-17avoid saying order=0, instead say PHASE3_CONFIGMichael Merickel
2015-02-17fix odd sentenceMichael Merickel
2015-02-17expose public config phases in pyramid.configMichael Merickel
2015-02-17fix merge conflictsChris McDonough
2015-02-17Merge branch 'master' of github.com:Pylons/pyramidChris McDonough
2015-02-17Merge pull request #1583 from Pylons/fix.remove-cachebust-tokensMichael Merickel
remove the token from the ICacheBuster api
2015-02-17update changelogMichael Merickel
2015-02-17use super with mixins... for reasonsMichael Merickel
2015-02-17remove the token from the ICacheBuster apiMichael Merickel
This exposes the QueryStringCacheBuster and PathSegmentCacheBuster public APIs alongside the md5-variants. These should be more cleanly subclassed by people wishing to extend their implementations.
2015-02-16Merge pull request #1581 from Pylons/feature.unittest-request-methodsMichael Merickel
add InstancePropertyHelper and apply_request_extensions
2015-02-16docstring on apply_propertiesMichael Merickel
2015-02-16update changelog for #1581Michael Merickel
2015-02-16add InstancePropertyHelper and apply_request_extensionsMichael Merickel
2015-02-13Merge pull request #1578 from davisagli/fix.docsMichael Merickel
Fix a couple minor documentation issues
2015-02-13Merge pull request #1577 from davisagli/fix.reloader-pdb-echoMichael Merickel
Add workaround to make sure echo is enabled after reload
2015-02-13add pull request referenceDavid Glick
2015-02-12fix instructions for running coverage via toxDavid Glick
2015-02-12remove obsolete note about raise_keyboard_interrupt that's left over from pasteDavid Glick
2015-02-12Add workaround to make sure echo is enabled after reload (refs #689)David Glick
Also add myself to CONTRIBUTORS.txt
2015-02-11Merge pull request #1576 from sontek/fix_toxMichael Merickel
Don't create sdist with tox (latest setuptools doesn't like mixing)
2015-02-10Don't create sdist with tox (latest setuptools doesn't like mixing)John Anderson
2015-02-10update changelog for #1574Michael Merickel
2015-02-10Merge pull request #1574 from dstufft/patch-1Michael Merickel
Prevent timing attacks when checking CSRF token
2015-02-10Default to an empty string instead of NoneDonald Stufft
2015-02-10Prevent timing attacks when checking CSRF tokenDonald Stufft
2015-02-07Merge pull request #1498 from sontek/allow_class_method_directlyMichael Merickel
Alert the user if they are using an unbound class methods to `add_view`
2015-02-07Merge pull request #1520 from sontek/catch_bad_request_method_nameMichael Merickel
Catch bad `name` and raise a `ValueError`
2015-02-07Fix py32 supportJohn Anderson
2015-02-07Remove `native_` import, not used anymoreJohn Anderson
2015-02-07Raise error at configuration timeJohn Anderson
2015-02-07Merge branch 'master' of https://github.com/Pylons/pyramid into ↵John Anderson
allow_class_method_directly Conflicts: pyramid/compat.py
2015-02-07Merge branch 'master' of https://github.com/Pylons/pyramid into ↵John Anderson
catch_bad_request_method_name
2015-02-07Merge pull request #1566 from bertjwregeer/feature/pcreate-helpMichael Merickel
When running pcreate without scaffold, list scaffolds
2015-02-07Add test for no scaffold no project nameBert JW Regeer
This test at least makes sure that if there is no scaffold and no project name that the command exists with error 2
2015-02-07Use hammer to fix holeBert JW Regeer