Re: Why does direct_to_template require a db?

2007-07-25 Thread Jeremy Dunck

On 7/25/07, omat <[EMAIL PROTECTED]> wrote:
>
> Thanks for the reply...
>
> This is a simple application that highlights source code of a remote
> resource, so I don't need sessions either.

OK, but you've still not set TEMPLATE_CONTEXT_PROCESSORS.  This
setting is used any time RequestContext is used-- and
direct_to_template uses it.

The default TEMPLATE_CONTEXT_PROCESSORS setting includes the auth
processor.  As previously mentioned, you'll need to override the
default to *not* use it.

This is the default:
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
)

If you don't override it in your settings file, that's what you get.

So, you probably want this in your settings file:

TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
)

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Why does direct_to_template require a db?

2007-07-25 Thread omat

To clarify, in urlpatterns:

(r'^$', 'django.views.generic.simple.direct_to_template', {'template':
'index.html'})

causes the mentioned problem, but

(r'^$', 'highlighter.views.index'),

works fine, where "highlighter.views.index" is

def index(request):
return render_to_response('index.html')

with the exact same settings.


Regards...


On 25 Temmuz, 14:51, omat <[EMAIL PROTECTED]> wrote:
> Thanks for the reply...
>
> This is a simple application that highlights source code of a remote
> resource, so I don't need sessions either.
>
> After removing the sessions too, I end-up with a minimal settings
> file:http://dpaste.com/15278/
>
> Now, django raises an AttributeError and complains that:
> 'WSGIRequest' object has no attribute 'user'
>
> Here is the traceback:
>
> Traceback (most recent call last):
> File "c:\Python25\lib\site-packages\django\core\handlers\base.py" in
> get_response
>   77. response = callback(request, *callback_args, **callback_kwargs)
> File "c:\Python25\Lib\site-packages\django\views\generic\simple.py" in
> direct_to_template
>   16. c = RequestContext(request, dictionary)
> File "c:\Python25\Lib\site-packages\django\template\context.py" in
> __init__
>   100. self.update(processor(request))
> File "c:\Python25\Lib\site-packages\django\core\context_processors.py"
> in auth
>   18. 'user': request.user,
>
>   AttributeError at /
>   'WSGIRequest' object has no attribute 'user'
>
> On 25 Temmuz, 02:09, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
>
> > On 7/24/07, omat <[EMAIL PROTECTED]> wrote:
>
> > > Why does direct_to_template require a database at all?
>
> > It doesn't directly require it.  You must be using something that does.
>
> > Are you using sessions?
>
> > It does use RequestContext, which runs TEMPLATE_CONTEXT_PROCESSORS,
> > which includes django.core.context_processors.auth by default.
>
> > Which is to say, you should define TEMPLATE_CONTEXT_PROCESSORS without
> > that default processor.
>
> > If that doesn't work, please put your settings file and template
> > redacted) up on dpaste.com, then reply with that URL.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Why does direct_to_template require a db?

2007-07-25 Thread omat

Thanks for the reply...

This is a simple application that highlights source code of a remote
resource, so I don't need sessions either.

After removing the sessions too, I end-up with a minimal settings
file:
http://dpaste.com/15278/

Now, django raises an AttributeError and complains that:
'WSGIRequest' object has no attribute 'user'


Here is the traceback:

Traceback (most recent call last):
File "c:\Python25\lib\site-packages\django\core\handlers\base.py" in
get_response
  77. response = callback(request, *callback_args, **callback_kwargs)
File "c:\Python25\Lib\site-packages\django\views\generic\simple.py" in
direct_to_template
  16. c = RequestContext(request, dictionary)
File "c:\Python25\Lib\site-packages\django\template\context.py" in
__init__
  100. self.update(processor(request))
File "c:\Python25\Lib\site-packages\django\core\context_processors.py"
in auth
  18. 'user': request.user,

  AttributeError at /
  'WSGIRequest' object has no attribute 'user'



On 25 Temmuz, 02:09, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> On 7/24/07, omat <[EMAIL PROTECTED]> wrote:
>
> > Why does direct_to_template require a database at all?
>
> It doesn't directly require it.  You must be using something that does.
>
> Are you using sessions?
>
> It does use RequestContext, which runs TEMPLATE_CONTEXT_PROCESSORS,
> which includes django.core.context_processors.auth by default.
>
> Which is to say, you should define TEMPLATE_CONTEXT_PROCESSORS without
> that default processor.
>
> If that doesn't work, please put your settings file and template
> redacted) up on dpaste.com, then reply with that URL.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Why does direct_to_template require a db?

2007-07-24 Thread Jeremy Dunck

On 7/24/07, omat <[EMAIL PROTECTED]> wrote:
> Why does direct_to_template require a database at all?
>

It doesn't directly require it.  You must be using something that does.

Are you using sessions?

It does use RequestContext, which runs TEMPLATE_CONTEXT_PROCESSORS,
which includes django.core.context_processors.auth by default.

Which is to say, you should define TEMPLATE_CONTEXT_PROCESSORS without
that default processor.

If that doesn't work, please put your settings file and template
redacted) up on dpaste.com, then reply with that URL.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---