Skip to content

Add get conference view to handle /<conference_slug> urls and act accordingly#647

Merged
palnabarun merged 1 commit intopythonindia:masterfrom
palnabarun:add-conference-root
Mar 23, 2020
Merged

Add get conference view to handle /<conference_slug> urls and act accordingly#647
palnabarun merged 1 commit intopythonindia:masterfrom
palnabarun:add-conference-root

Conversation

@palnabarun
Copy link
Member

@palnabarun palnabarun commented Mar 22, 2020

Two cases may exist when accessing /<conference_slug> :

  1. Conference Exists - Redirect to /<conference_slug>/proposals
  2. Conference Does not exist - Show 404 Page

Fixes #645

@palnabarun palnabarun requested a review from ananyo2012 March 22, 2020 04:56
@palnabarun
Copy link
Member Author

@ananyo2012 Can you please review this?

@coveralls
Copy link

coveralls commented Mar 22, 2020

Coverage Status

Coverage increased (+0.1%) to 67.259% when pulling 5248bd8 on palnabarun:add-conference-root into 87c3172 on pythonindia:master.

@ananyo2012
Copy link
Contributor

@palnabarun There is a linter error can you fix that ?

@ananyo2012
Copy link
Contributor

ananyo2012 commented Mar 22, 2020

@palnabarun This is causing another issue since any url is being redirected as a conference url and its unable to find a conference in get_conference. Probably you need to put the url pattern at the very end so that an url will fallback to that if none of the defined urlpatterns match.

@palnabarun palnabarun force-pushed the add-conference-root branch from 99f2979 to 76beaf6 Compare March 22, 2020 07:40
@palnabarun
Copy link
Member Author

palnabarun commented Mar 22, 2020

@ananyo2012 That stems from the fact that the root resource in Junction is assumed to be a conference slug.

Ideally, the URL for the conference resource should have been /conference/<conference_slug>/* instead of /<conference_slug>/*. Using a resource identifier at the root is not a correct way. The other resources are structured correctly.

So, in the current scenario, /anything-that-the-user-writes-here is assumed to be a conference slug and checked for.

I would have liked to fix the URL's in the first place. But, it seemed to be a rabbit hole as the whole codebase needs to be searched for hardcoded URL's.


Probably you need to put the url pattern at the very end so that an url will fallback to that if none of the defined urlpatterns match.

Will it not still result in a conference not found? I am a bit confused here with respect to the expectations. Can you please provide a map of the possible use case that you are thinking?

@palnabarun palnabarun force-pushed the add-conference-root branch from 76beaf6 to a6cc9bf Compare March 22, 2020 08:29
@ananyo2012
Copy link
Contributor

@palnabarun Try going to /profiles and you will get a 404 error. /profiles lists all proposals submitted by an user. Since we assume that can also be a conference we try to get the corresponding Conference in get_conference and then show a 404 since no such valid conference is present.

Ideally, the URL for the conference resource should have been /conference/<conference_slug>/* instead of /<conference_slug>/*. Using a resource identifier at the root is not a correct way. The other resources are structured correctly.

I like this solution. We need to see how much impact will it cause to the existing test cases and usability.

@palnabarun
Copy link
Member Author

palnabarun commented Mar 22, 2020

Try going to /profiles and you will get a 404 error. /profiles lists all proposals submitted by an user.

Got it.

I see a pattern now of which URL's will error out.

@ananyo2012
Copy link
Contributor

ananyo2012 commented Mar 22, 2020

On second thought having a /conference/<conference_slug>/ url will mean the cfp absolute url will be https://in.pycon.org/cfp/conference/<conference_slug> which is not appropriate. Junction seems to be deployed under /cfp url. Maybe past junction maintainers had reasons for designing the urls like that.

…ordingly

Two cases may exist when accessing `/<conference_slug>` :
1. Conference Exists - Redirect to `/<conference_slug>/proposals`
2. Conference Does not exist - Show 404 Page

Integration Tests for the above cases are also added.
@palnabarun palnabarun force-pushed the add-conference-root branch from a6cc9bf to 5248bd8 Compare March 22, 2020 12:39
@palnabarun
Copy link
Member Author

Basic question:

the cfp absolute url will be https://in.pycon.org/cfp/conference/<conference_slug> which is not appropriate

Why?


Let's, not dilly dally on what is there in the present. Maybe they started the routing keeping something in mind and then maybe thought that is not correct but had no way to change things at that point in time. Let's focus on what is correct and suits better.

I couldn't find history and discussion related to the URL convention based on commits.

@palnabarun
Copy link
Member Author

Nevertheless, I have reorganized the URL order so that the routing works as expected.

Copy link
Contributor

@ananyo2012 ananyo2012 left a comment

Choose a reason for hiding this comment

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

Looks good now. Ship it!

@pradyunsg
Copy link
Contributor

LGTM.

Regarding the hardcoded URLs, I'm personally OK to break existing URLs to completely restructure the application's URL structure.

@palnabarun palnabarun merged commit 677fa09 into pythonindia:master Mar 23, 2020
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.

Non proposal sub urls are broken

4 participants