#12161 closed (fixed)
Error in code example - Generic views (regular expression)
Reported by: | infopams | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.1 |
Severity: | Keywords: | regular-expression documentation generic-views | |
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
(at this page: http://docs.djangoproject.com/en/dev/topics/generic-views/)
This code example is nonfuctional:
from django.conf.urls.defaults import * from django.views.generic.simple import direct_to_template from mysite.books.views import about_pages urlpatterns = patterns('', ('^about/$', direct_to_template, { 'template': 'about.html' }), ('^about/(w+)/$', about_pages), )
It should be like this:
from django.conf.urls.defaults import * from django.views.generic.simple import direct_to_template from mysite.books.views import about_pages urlpatterns = patterns('', ('^about/$', direct_to_template, { 'template': 'about.html' }), ('^about/(\w+)/$', about_pages), )
In short: the token (w+) should be replaced for (\w+) in order to have de desired functionality
Attachments (1)
Change History (5)
comment:1 by , 15 years ago
Component: | Uncategorized → Documentation |
---|---|
Triage Stage: | Unreviewed → Accepted |
by , 15 years ago
Attachment: | 12161.diff added |
---|
comment:2 by , 15 years ago
Has patch: | set |
---|---|
Triage Stage: | Accepted → Ready for checkin |
comment:3 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 by , 15 years ago
I think second changed line is a raw string, and don't must to be escaped
Note:
See TracTickets
for help on using tickets.
(In [12182]) Fixed #12161 -- Added escaping of a backslash in two generic-views.txt examples. Thanks, infopams