views:

74

answers:

1

http://docs.djangoproject.com/en/dev/intro/tutorial03/

I was at the step Decoupling the URLconfs where the tutorial illustrates how to decouple urls.py. On doing exactly what it says, i get the following error-

error at /polls/1/
nothing to repeat
Request Method: GET
Request URL:    http://localhost:8000/polls/1/
Exception Type: error
Exception Value:    
nothing to repeat
Exception Location: C:\jython2.5.1\Lib\re.py in _compile, line 241
Python Executable:  C:\jython2.5.1\jython.bat
Python Version: 2.5.1
Python Path:    ['E:\\Programming\\Project\\django_app\\mysite', 'C:\\jython2.5.1\\Lib\\site-packages\\setuptools-0.6c11-py2.5.egg', 'C:\\jython2.5.1\\Lib', '__classpath__', '__pyclasspath__/', 'C:\\jython2.5.1\\Lib\\site-packages']
Server time:    Mon, 12 Apr 2010 12:02:56 +0530
+1  A: 

Check your regex syntax. In particular, see if you are missing an opening parenthesis before a ? towards the beginning of the pattern, as in

r'^?P<poll_id>\d+)/$'
#  ^ note the missing parenthesis

The above should read

r'^(?P<poll_id>\d+)/$'

instead.

(An explanation: "nothing to repeat" is a regex error which arises due to an ? regex operator occurring where it is not preceded by something which it can sensibly attach to. The ? in (?P<...>...) is treated specially, but if you forget the opening parenthesis, the regex engine will treat ? in the regular way, which makes no sense right after ^.)

Michał Marczyk
that solved the problem :).. thanx
Nitin Garg