--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/1450171a-be2b-41e8-b221-91bfe656d039%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAK8PqJEbne2fp9X3Q1Dgr7OG3Ns54A1gqdndwCD5FXNT8j%3DXTw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/D5256C17-164F-4123-B07C-7A62100AE7F1%40polytechnique.org.
urlpatterns = [
url_tree('articles/',
url('2003/', views.special_case_2003),
url_tree('<int:year>/',
url('', views.year_archive),
url_tree('<int:month>/',
url('', views.month_archive),
url('<int:day>/', views.article_detail),
),
),
),
]
On Oct 4, 2016 15:53, ludovic coues <cou...@gmail.com> wrote:
>
>
> The question about the old routing system is about the plan to build
> on top the old one. I'm not saying the old one is bad. But if we start
> to build upon it, it will be harder to replace it. It might be more
> interesting to refactor the routing system, so the new one could be
> build next to the old one, rather than on top.
>
> This might open the way for third party module providing new way to
> route request in django.
To be fair, the current routing system is reasonably loosely coupled to the rest of Django. If the simpler version were to be built on top of the old system, it would be tightly coupled to the old system, but would not make it any harder to replace it with another 3rd party module than currently is possible.
As I documented in my blog post: if you want you can mostly replace the current URL routing, all you need is to have a class that defines `resolve`. Reversing URLs is a different matter, and I hope to work on a pull request to change the URL reversing to make it also a bit more pluggable.
In all fairness, it's actually
magic_urlpatterns_you_will_never_see = path('/', include(the_urlconf))
Django uses the magic_urlpatterns_you_will_never_see, which already includes that slash.
My recommendation would be to forgo the starting slash. In Flask you provide the full route ("absolute path") to your view, in Django the relative path. Relative paths don't start with a slash.
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/70d64bf4-6ba9-444f-b161-165e6607d257%40googlegroups.com.
urlpatterns = [
url(r'^articles/2003/$', views.special_case_2003),
url(r'^articles/(?P<year>[0-9]{4})/$', views.year_archive),
url(r'^articles/(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/$', views.month_archive),
url(r'^articles/(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/(?P<day>[0-9]{2})/$', views.article_detail),
url(r'^articles/(?P<slug>[\w-]+)/$', views.slug_view),
]
urlpatterns = [
path('articles/2003/', views.special_case_2003),
path('articles/<int:year>/', views.year_archive),
path('articles/<int:year>/<int:month>/', views.month_archive),
path('articles/<int:year>/<int:month>/<int:day>/', views.article_detail),
path('articles/<string:slug>/', views.slug_view),
]
@app.route('articles/2003/')
def special_case_2003():
pass
@app.route('articles/<int:year>/')
def year_archive(year):
pass
@app.route('articles/<int:year>/<int:month>/')
def month_archive(year, month):
pass
@app.route('articles/<int:year>/<int:month>/<int:day>/')
def article_detail(year, month, day):
pass
@app.route('articles/<string:slug>/')
def slug_view(slug):
pass
BottleIt's basically Flask (big surprise).
@route('articles/2003/')
def special_case_2003():
pass
@route('articles/<year:int>/')
def year_archive(year):
pass
@route('articles/<year:int>/<month:int>/')
def month_archive(year, month):
pass
@route('articles/<year:int>/<month:int>/<day:int>/')
def article_detail(year, month, day):
pass
@route('articles/<slug:string>/')
def slug_view(slug):
pass
config.add_route('special_case_2003', 'articles/2003/')
config.add_route('year_archive', 'articles/{year}/')
config.add_route('month_archive', 'articles/{year}/{month}/')
config.add_route('article_detail', 'articles/{year}/{month}/{day}/')
config.add_route('slug_view', 'articles/{slug}/')
config.scan()
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/db1f38e2-3716-41d0-870e-ea7b84d0cfc6%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/e62c279f-4f0b-4cbc-9f98-36650407835e%40googlegroups.com.
It would shadow the stdlib os.path, albeit not as a library, but as a function.
FlaskDoesn't really have the idea of putting all your routes in one spot. So pardon the silly example.@app.route('articles/2003/') def special_case_2003(): pass @app.route('articles/<int:year>/') def year_archive(year): pass @app.route('articles/<int:year>/<int:month>/') def month_archive(year, month): pass @app.route('articles/<int:year>/<int:month>/<int:day>/') def article_detail(year, month, day): pass @app.route('articles/<string:slug>/') def slug_view(slug): pass
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/1177f3c9-fe36-41b4-b6b3-69daae8d8409%40googlegroups.com.
On 2 May 2017, at 07:39, Emil Stenström <e...@kth.se> wrote:
What's missing now is someone from the core team that can help push this into being ready for master. Is there someone that would like to be the hero for everyone teaching django to beginners? :)
I talked to Sjoerd separately. He is also very busy at the moment, but was working on getting merge conflicts resolved soon. He will also post a list of things that are still missing, but spontaneously thought that this list would be short.
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/c39a40a0-25b3-4a7b-b002-767fadb38db7%40googlegroups.com.
- The more complex part is (I think) figuring out how to deal with cases where we have a `path('/<something:int>', include(other_urls))` and `other_urls` also has a `path()` mentioning `something`. However this might just be my perfectionism and paranoia seeing edge-cases where there are none, or are sufficiently "edge" cases that we can suffice with a "just don't do it!".
- The more complex part is (I think) figuring out how to deal with cases where we have a `path('/<something:int>', include(other_urls))` and `other_urls` also has a `path()` mentioning `something`. However this might just be my perfectionism and paranoia seeing edge-cases where there are none, or are sufficiently "edge" cases that we can suffice with a "just don't do it!".
The current resolver doesn't really handle this either. When resolving, the current implementation simply passes on the outermost capture group to the view. When reversing you can only pass in a single value that must match both groups. If you can solve it, great, but I think it's sufficient to let the underlying resolver handle it the same way.
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/d75698e7-e75e-4719-a000-4172f3ed1082%40googlegroups.com.
Hi Sjoerd,I too would love to see this feature in Django 2.0; in fact, I've been following its progress quite closely. I would love to help out with it and have the necessary time to do so.
On Thu, Jul 27, 2017 at 5:06 PM, Sjoerd Job Postmus <sjoe...@sjec.nl> wrote:
Hi all,Due to scheduling, I have not been able to give this the attention I would like to give it, and I don't see myself freeing up a significant amount of time to give it the final push forward before the feature freeze on September 18th.I did a final review of my changes. Though there are some things that might need a bit of cleaning up, I have the feeling the pull request (https://github.com/django/django/pull/7482) is in a reasonable state. There are a lot of comments by me about things that might be improved, though. There's also a TODO list (https://github.com/django/django/pull/7482#issuecomment-305482442) about things that still need doing.Based on the check-list, I think the following items remain:- Documentation the new syntax (but Tom already has a PR open for that), but that should only be picked up after this feature is merged/mergeable.- Updating existing documentation (maybe even the tutorial?) to use the new syntax. I think that's also included in Tom's PR.- Extra tests. There are dedicated tests already, but given such a core feature I would feel more comfortable if there were even more tests.- Not mentioned in the checklist, but performance concerns should also be checked [1].Personally, I would love for this feature to land in Django 2.0, but I'm doubtful that I can push it further myself, and would be greatly appreciative if somebody were willing to help push it forward.[1]: Previously, the code used `LocaleRegexDescriptor`, which acted as `@property` when the regular expression was lazy, while if it is a pure string it would set the attribute directly as an optimisation trick. This might need to be replicated.Regards,Sjoerd Job
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/12ac3285-5d09-4fe1-bbf2-b34c75150724%40googlegroups.com.
Hi Sjoerd, Emil (and everyone else),I wanted to give a quick update here so you all have some visibility into the progress being made. I have begun by working on the "Update the tests throughout, updating to the new style wherever possible." in Sjoerd's check list just to get my feet wet and familiarize myself with the code base a little more, how path() works, etc.At this point I've converted the URL configs for all test packages with the following exceptions:1.) auth_tests - About 16 tests are still failing, all related to password-reset.
2.) check_framework - path() makes some URLs configurations valid that are not valid with url() such as including '$' in an include, etc. For the time being, I have elected not to convert the URLs that would be valid with path() but not url(). I am sure this merits some discussion. If it's already been discussed and I missed it, just let me know.
3.) generic_views - 16 tests are failing, all related to date tests. I suspect the majority of problems here will be fixed by getting urls.py exactly correct. I do think there may have to be a small change to the _date_from_string method in /generic/dates.py, however.
4.) i18n - I haven't dealt much with i18n in the past so I've left this one for a bit later.5.) messages_test - Only one failure that I need to figure out.
6.) urlpatterns_reverse - Should these be left as is, and similar tests for path() be created since url() will not be deprecated immediately?
Given the patch's current state, I'm feeling a bit overwhelmed at the prospect of reviewing it in a day or two. I didn't do a good job of communicating this release cycle, but in the past, I've set a soft deadline of two weeks before the alpha deadline for huge patches to be complete so that reviews don't have to be rushed.
Perhaps we can find a compromise to ship this feature in the alpha with minimal docs and complete the docs later?
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/ada721d9-50f9-42e8-97eb-d4fbb073bddf%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/a0d798b3-2177-433b-a1fb-253ca1b0442e%40googlegroups.com.
Hi folks,I wanted to push forward the consideration of introducing a simpler URLs syntax, plus support for URL parameter type conversion.A pre-proposal is available here: https://gist.github.com/tomchristie/cb388f0f6a0dec931c611775f32c5f98At this point I'm seeking feedback, before hopefully iterating on the proposal, and making a formal submission.I'm not making any assumptions right now about where this might get too, or who'd be involved if it does make it to the DEP stage, and would very much welcome outside involvement. I'm also aware that while there's been some positive reception, it's not yet clear if we'll reach a consensus on inclusion in core.Personally I'm very firmly +1 on this, as I feel that the existing syntax is a rather glaring and unnecessary pain point.Thanks to everyone who's started to kick this off, in particular Emil Stenström for raising the original thread, and Sjoerd Job Postmus for their work on the Django Simple URL package.- Tom