Al 05/08/12 13:43, En/na Blaxton ha escrit:

Hi

Why following line cause an invalid syntax :
(r'^myform/$', 'mysite.views.myform', name="myform"),

Because it's syntax is invalid: the 'name=value' is allowed in function calls but not in tuples.

Try with:

urlpatterns = patterns('',
    url(r'^myform/$', 'mysite.views.myform', name="myform"),
    ...
)

it seems named url pattern has changed from name="myform" to just 'myform'
because when I change it to:
(r'^myform/$', 'mysite.views.myform', 'myform'),

it pass the syntax error and throw another error :

dictionary update sequence element #0 has length 1; 2 is required

When you use a tuple the syntax is:

(regular expression, Python callback function [, optional dictionary [, optional name]])

the third element, if present, is expected to be a dictionary. Try with:

(r'^myform/$', 'mysite.views.myform', {}, 'myform')




HTH

--
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.

Reply via email to