Skip to content
This repository has been archived by the owner on Jul 18, 2022. It is now read-only.

Add rename feature! #13

Closed
wants to merge 3 commits into from
Closed

Conversation

katomaso
Copy link
Contributor

Please merge after #12

Add capability to rename hard coded names inside patters.

url(U / 'user' / slug, my_view) # view has to be def my_view(request, slug)
# but in case of libraries we often need a different argument name than 'slug'
url(U / 'user' / slug % 'username', library_view) # view is def library_view(request, username)

I think that modulo operator reminds of formatting operator thus can be viewed as formatting the name. Hope you like this solution.

Cheers
Tom

@coveralls
Copy link

coveralls commented Mar 19, 2017

Coverage Status

Coverage decreased (-1.1%) to 95.522% when pulling 71d97cc on katomaso:feature/rename into 462a774 on Visgean:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-1.1%) to 95.522% when pulling 71d97cc on katomaso:feature/rename into 462a774 on Visgean:master.

@Visgean
Copy link
Owner

Visgean commented Mar 19, 2017

I find this to be more confusing then simply using a new regular expression.

@katomaso
Copy link
Contributor Author

But it is a nice option for lazy people like me who just want to rename default pattern

@Visgean
Copy link
Owner

Visgean commented Mar 25, 2017

maybe something like slug('project_slug') could work. If we replaced slug with a function...

@katomaso
Copy link
Contributor Author

That would be very intrusive. The syntax I proposed is three-line change in code. We could think of other operator maybe?

@Visgean
Copy link
Owner

Visgean commented Mar 26, 2017

I don't find this solution pretty, but I think users are perfectly able to use any kind of libraries providing such functionality...

@Visgean Visgean closed this Mar 26, 2017
@katomaso katomaso deleted the feature/rename branch April 1, 2017 11:13
@katomaso
Copy link
Contributor Author

katomaso commented Apr 1, 2017

Can be done easily via slug.replace("slug", "action") so this pull request was really unnecessary

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants