oh 0k. thanks dude! I was about to declare that myself.
Thanks! On Jun 29, 11:45 pm, Alex Gaynor <alex.gay...@gmail.com> wrote: > On Mon, Jun 29, 2009 at 10:39 AM, djangonoob <ye.eug...@gmail.com> wrote: > > > Hi all, > > i am following the tutorial on the link in the subject, > >http://www.djangobook.com/en/2.0/chapter03/ > > and i ran into some trouble. > > > ******************************************************************** > > from django.conf.urls.defaults import * > > from mysite.views import hello, current_datetime, hours_ahead > > > urlpatterns = patterns('', > > (r'^hello/$', hello), > > (r'^time/$', current_datetime), > > (r'^time/plus/(\d{1,2})/$', hours_ahead), > > ) > > ******************************************************************** > > > I followed th instructions and than i ran into an erro which states : > > 'tuple' object is not callable > > > Here's a complete error message: > > *************************************************************************** > > Request Method: GET > > Request URL: http://localhost:8000/time/plus/3/ > > Exception Type: TypeError > > Exception Value: > > > 'tuple' object is not callable > > > Exception Location: /home/eugene/public_html/django/mysite/../mysite/ > > urls.py in <module>, line 21 > > Python Executable: /usr/bin/python > > Python Version: 2.6.2 > > Python Path: ['/home/eugene/public_html/django/mysite', '/usr/lib/ > > python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib- > > tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/ > > usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/ > > Numeric', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/ > > dist-packages/gst-0.10', '/var/lib/python-support/python2.6', '/usr/ > > lib/python2.6/dist-packages/gtk-2.0', '/var/lib/python-support/ > > python2.6/gtk-2.0', '/usr/lib/python2.6/dist-packages/wx-2.8-gtk2- > > unicode', '/usr/local/lib/python2.6/dist-packages'] > > Server time: Mon, 29 Jun 2009 10:31:46 -0500 > > > *************************************************************************** > > > Here are my code: > > > views.py : > > ************************************************************* > > from django.http import Http404, HttpResponse > > import datetime > > > def hello(request): > > return HttpResponse("hello world") > > > def current_datetime(request): > > now = datetime.datetime.now() > > html = "<html><body>It is now %s.</body></html>" % now > > return HttpResponse(html) > > > def home(request): > > return HttpResponse("This is a home page") > > > 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) > > > ************************************************************* > > > urls.py > > ************************************************************* > > from django.conf.urls.defaults import * > > from mysite.views import hello, home, current_datetime, hours_ahead > > > urlpatterns = patterns('', > > > ('^hello/$', hello), > > ('^$', home), > > ('^time/$', current_datetime) > > (r'^time/plus/(\d{1,2})/$', hours_ahead), > > > ) > > *********************************************************** > > > Any idea where did i go wrong? > > > Why did i receive a 'tuple' object is not callable errors? > > > Best Regards, > > EUgene > > If you look you are misisng a comma after one of the lines in your URLconf > (the 2nd URL). That's what causes this issue. > > Alex > > -- > "I disapprove of what you say, but I will defend to the death your right to > say it." --Voltaire > "The people's good is the highest law."--Cicero --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---