Выполняю пример согласно http://djbook.ru/ch03s05.html
В файле связок urls.py имею следующую связку:
from DjangoProject.views import hours_ahead
urlpatterns = patterns('',
(r'^time/plus/\d{1,2}/$', hours_ahead),
)
from django.http import HttpResponse
from django.http import Http404
import datetime
def hours_ahead(request, offset):
try:
offset = int(offset)
except ValueError:
raise Http404()
dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
html = "<html><body>In %s hour(s), it will be %s.</body></html>" % (offset, dt)
return HttpResponse(html)
TypeError at /time/plus/10/
hours_ahead() takes exactly 2 arguments (1 given)
Request Method: GET
Request URL: http://127.0.0.1:8000/time/plus/10/
Exception Type: TypeError
Exception Value:
hours_ahead() takes exactly 2 arguments (1 given)
Exception Location: C:\Python26\lib\site-packages\django\core\handlers\base.py in get_response, line 92
Python Executable: C:\Python26\python.exe
Python Version: 2.6.3
Python Path: ['C:\\Documents and Settings\\Istergu1\\workspace\\DjangoProject', 'C:\\WINDOWS\\system32\\python26.zip', 'C:\\Python26\\DLLs', 'C:\\Python26\\lib', 'C:\\Python26\\lib\\plat-win', 'C:\\Python26\\lib\\lib-tk', 'C:\\Python26', 'C:\\Python26\\lib\\site-packages']
Server time: Wed, 9 Dec 2009 23:35:01 +0300