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

Adds get_build_path to BuildableTemplateView, which can handle a build_path property set to reverse_lazy #122

Merged
merged 6 commits into from
Jun 15, 2018

Conversation

mattaustin
Copy link
Contributor

@mattaustin mattaustin commented Mar 19, 2018

I've added a get_build_path method to BuildableTemplateView. This coerces the build_path property to text, and strips any preceding '/', which allows us to set build_path to reverse_lazy values. This partially resolves issue #120 (we're not handling 'directory' paths yet).

There is some related further work I'd like to complete, but I didn't want to create a huge diff in one pull request. If this gets accepted, I'll continue work on:

  • Handling build_path (and reverse_lazy) values which do not include an explicit filename (similar to how BuildableDetailView works), e.g. handling a value of "/about/", without having to specify "about/index.html". This would include a setting to allow an alternative "default" filename, rather than hard-coding 'index.html' in python code in multiple places.
  • Eventually moving common "build_path" functionality from Buildable[Template/Detail/List/Date]Views to the base "BuildableMixin".

…_explicit_filename`` and ``test_template_view_with_directory`` in preparation for further tests.
… build_path property coerced to text and stripped of a preceding '/'. The build method now calls get_build_path, rather than using the build_path property directly.
@coveralls
Copy link

coveralls commented Mar 19, 2018

Coverage Status

Coverage remained the same at 79.845% when pulling 2bd6ceb on mattaustin:reverse_lazy into 18bbb24 on datadesk:master.

…rlpatterns, so we can get away with not requiring mock module on python 2.
@palewire
Copy link
Owner

I like your incremental approach here. I know there are people out there, including myself, who have implemented dynamic build paths already with properties like

@property
def build_path(self):
    # Do python blah blah
    return path

I think this upgrade will be backwards compatible with that pattern. I'd like to confirm that. Once I do, I think we can merge this.

@palewire palewire merged commit 2bd6ceb into palewire:master Jun 15, 2018
@palewire
Copy link
Owner

Sorry this took me so long to merge. It is in master and will ship to PyPI with a new version once it gets past the TravisCI tests with my other changes.

@mattaustin mattaustin deleted the reverse_lazy branch July 2, 2018 03:56
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.

3 participants