Apologies for subjecting people to my debugging effort, but I have now tried
to replicate the problem with a minimal installation.

I create a new project with django-admin.py, and simply edit the database
settings to fit my DB, then run syncdb.
Then I create a minimal urls.py like this:

from django.conf.urls.defaults import *

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
    # Example:
    # (r'^tt/', include('tt.foo.urls')),

    # Uncomment the next line to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    # (r'^admin/(.*)', admin.site.root),
    ('^accounts/login/(.*)', 'django.contrib.auth.views.login'),
    ('^accounts/profile/(.*)', 'django.contrib.auth.views.profile'),
    ('^accounts/logout/(.*)', 'django.contrib.auth.views.logout',
{'next_page': '/'}),

)

Going to /accounts/login will now try to load the template u'', which it
cannot find of course because the string is empty. (Call stack as in my
previous post).

Now if I change my urls.py to set the template_name directly, I get
TypeError at /accounts/login/

login() got multiple values for keyword argument 'template_name'


The urls.py for this is (nothing changed but the explict template_name
parameter  for login)

from django.conf.urls.defaults import *

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
    # Example:
    # (r'^tt/', include('tt.foo.urls')),

    # Uncomment the next line to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    # (r'^admin/(.*)', admin.site.root),
    ('^accounts/login/(.*)', 'django.contrib.auth.views.login',
{'template_name' : '/registration/login.html'}),
    ('^accounts/profile/(.*)', 'django.contrib.auth.views.profile'),
    ('^accounts/logout/(.*)', 'django.contrib.auth.views.logout',
{'next_page': '/'}),

)

Can someone else recreate this problem with SVN trunk (or beta1)? or is it
somehow a strange setup problem on my machine here?

Ludwig


2008/8/26 Ludwig <[EMAIL PROTECTED]>

> I just tried the same with a fresh installation from SVN trunk and get the
> same error.
>
> 2008/8/26 Ludwig <[EMAIL PROTECTED]>
>
> Try again:
>>
>> If I do this in urls.py
>>
>> ...
>>     ('^accounts/login/(.*)', 'django.contrib.auth.views.login'),
>> ...
>>
>> I get TemplateDoesNotExist exception, because the template parameter is
>> empty. The full snippet is
>> http://dpaste.com/73893/
>> The template name is empty already at the callback (line 33) - so it gets
>> lost rather early.
>>
>>
>> If I do this (nothing else changed at all):
>> ...
>>     ('^accounts/login/(.*)', 'django.contrib.auth.views.login',
>> {'template_name': 'registration/login.html'}),
>> ...
>>
>> I get
>> TypeError at /accounts/login/ login() got multiple values for keyword
>> argument 'template_name' (one of them seems to be empty, the other one the
>> one I pass in).If I hardcode the template name in the django code as a
>> hack, it works, so there is nothing wrong with my template.
>>
>> It is a straight django 1.0 beta1 installation on Python 251 on XP.
>>
>> Bizarre.
>>
>> Ludwig
>>
>> 2008/8/25 Karen Tracey <[EMAIL PROTECTED]>
>>
>> 2008/8/25 Ludwig <[EMAIL PROTECTED]>
>>>
>>>> I am using the 1.0 beta 1 release.
>>>>
>>>> I think I am following the documentation, when I set
>>>>
>>>>     ('^accounts/login/(.*)', 'django.contrib.auth.views.login', {}),
>>>>
>>>> in my urls.py
>>>>
>>>> But then I get a TemplateDoesNotExist exception when opening
>>>> /accounts/login.
>>>>
>>>> The template (standard registration/login.html) does exist, but somehow
>>>> the template name gets lost in Django and it looks for an empty template
>>>> name u''.
>>>> Below is the relevant snippet from the error page:
>>>>
>>> [snip]
>>>
>>> The snippet is a bit too abbreviated to be of use.  It would be better if
>>> you selected the "Switch to copy-and-paste view" link and then the "Share
>>> this traceback on a public web site" button to post the traceback to
>>> dpaste.com and then post the link.
>>>
>>>
>>>> If I set the template name explicitly, I get the error that the kw arg
>>>> is doubly defined.
>>>> (If in auth.views.login I set the template_name explictly to my
>>>> template, overriding the empty string, it works, so my template is ok)
>>>>
>>>>
>>>  You should be able to set the template name explicitly like so:
>>>
>>> ('^accounts/login/(.*)', 'django.contrib.auth.views.
>>> login', {'template_name': 'path/login_template_name'}),
>>>
>>> If that is what you tried and you got some error about a kwarg being
>>> doubly defined that is rather mysterious.
>>>
>>> Karen
>>>
>>> >>>
>>>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to