Temporary session directory

2009-08-28 Thread John Barham

I'd like to store per-session files so need a way to reliably create a
per-session temp directory.  Is it reasonable to use the
session.session_key to generate a unique name?

Also, is there a way to have Django automatically run some code to
cleanup my session once it has expired?  Or do I have to resort to
cron?  (I'm using the file-based session backend.)

Thanks,

  John
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Displaying username on every page

2009-08-19 Thread John Barham

On Aug 19, 9:27 pm, Kenneth Gonsalves wrote:

> > Yes, I'd read about RequestContext but from what I understand you have
> > to pass it explicitly to render_to_response().  Is that the case?
>
> yes

Thanks for the confirmation.  In that case I'll have to write my own
render_to_response() wrapper.

  John
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Displaying username on every page

2009-08-19 Thread John Barham

On Aug 19, 5:06 pm, grahamu  wrote:

> If you use RequestContext(), you automatically get visibility to the
> current user and their permissions

(Sorry, I meant to say RequestContext instead of RequestInstance.)

Yes, I'd read about RequestContext but from what I understand you have
to pass it explicitly to render_to_response().  Is that the case?

  John
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Displaying username on every page

2009-08-19 Thread John Barham

Apologies in advance if this is a FAQ but I've searched the list and
can't find a precise answer.

I want to display the login status of the user at the top of every
page.  If they were logged in, it should say something like "Logged is
as  (Log Out)" and if they're not logged in it should show a
link to the login page.

I could of course pass in the username as a dictionary value for each
page, but this quickly becomes tedious.  I also use render_to_response
a lot and if I understand correctly it doesn't pass through the user
info automatically, but will if you set the context_instance parameter
to a RequestInstance.  Is there a way I can access the user info from
any page without having to do the above?

  John

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