Opened 17 years ago
Closed 17 years ago
#4908 closed (fixed)
Error in tutorial part 4
Reported by: | James Bennett | Owned by: | Jacob |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The sample URL configuration in part 4 of the tutorial uses the syntax of a url
call, but without calling url
(it passes in a final item to be the name of the URL).
Attachments (1)
Change History (7)
by , 17 years ago
Attachment: | tutorial04.diff added |
---|
comment:1 by , 17 years ago
Has patch: | set |
---|
Are you sure it's an error?
In django.conf.defaults
:
def patterns(prefix, *args): pattern_list = [] for t in args: if isinstance(t, (list, tuple)): t = url(prefix=prefix, *t)
It looks to me like the tuple should work just as well.
follow-up: 4 comment:2 by , 17 years ago
We had someone on IRC who was following the tutorial code exactly (double-checked by having him paste it) and it was erroring out saying there were too many arguments.
comment:3 by , 17 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
comment:4 by , 17 years ago
Replying to ubernostrum:
We had someone on IRC who was following the tutorial code exactly (double-checked by having him paste it) and it was erroring out saying there were too many arguments.
Are you 100% sure their checkout was up to date?
This code is working fine for us:
urlpatterns += patterns('satchmo.shop.views', (r'^cart/(?P<id>\d+)/remove/$', 'cart.remove', {}, 'satchmo_cart_remove'), )
comment:5 by , 17 years ago
Looking at the code, it looks like the tuple should still work, and others have confirmed this. So the real question here is do we want to recommend the use of url() over tuple? I would say yes.
comment:6 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Patch which fixes and clarifies the usage