Re: problem in remember me feature

2008-06-06 Thread Mayank Dhingra

any suggestions anyone ?

On Jun 4, 9:22 am, Mayank Dhingra <[EMAIL PROTECTED]> wrote:
> traceback
>
> UnboundLocalError at /login/
> local variable 'settings' referenced before assignment
>
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'myproject.dual_session_middleware.DualSessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.middleware.doc.XViewMiddleware')
>
> Traceback:
> File "C:\django\Python25\Lib\site-packages\django\core\handlers
> \base.py" in get_response
>   82. response = callback(request, *callback_args,
> **callback_kwargs)
> File "C:\django\myproject\..\myproject\myapp\views\auth_view.py" in
> login
>   42.   request.session[settings.PERSISTENT_SESSION_KEY] = True
>
> as mentioned earlier when i detect the "rememberme" option in post
> request i set
> request.session[settings.PERSISTENT_SESSION_KEY] = True but once in 5
> times or so it gives the above mentioned error.
>
> On May 30, 4:59 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
>
> > On Tue, May 27, 2008 at 3:58 AM, Mayank Dhingra <[EMAIL PROTECTED]>
> > wrote:
>
> > > I am experiencing a strange problem while using
> > > DualSessionMiddleware
>
> > >http://code.djangoproject.com/wiki/CookBookDualSessionMiddleware
>
> > > I've done as directed and in most cases the feature works as expected.
> > > When the request.post contains the "rememberme" i set
>
> > > request.session[settings.PERSISTENT_SESSION_KEY] = True
>
> > > but for some cases  about 15-20%  while doing so i get this error
>
> > > UnboundLocalError: local variable 'settings' referenced before
> > > assignment
>
> > > Could you suggest what am I doing wrong .?
>
> > Does the traceback show that the line you quote is the one that is causing
> > the UnboundLocalError?
>
> > What is the environment (dev server, Apache, ?) where the error occurs?
>
> > You say 15-20% of the time it fails -- can you see any pattern to when it
> > fails vs. when it works?
>
> > Pasting the full traceback and code in question out on dpaste may help
> > someone see what might be going wrong.
>
> > Karen
--~--~-~--~~~---~--~~
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: problem in remember me feature

2008-06-03 Thread Mayank Dhingra

traceback

UnboundLocalError at /login/
local variable 'settings' referenced before assignment

Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'myproject.dual_session_middleware.DualSessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware')


Traceback:
File "C:\django\Python25\Lib\site-packages\django\core\handlers
\base.py" in get_response
  82. response = callback(request, *callback_args,
**callback_kwargs)
File "C:\django\myproject\..\myproject\myapp\views\auth_view.py" in
login
  42.   request.session[settings.PERSISTENT_SESSION_KEY] = True

as mentioned earlier when i detect the "remember me" option in post
request i set
request.session[settings.PERSISTENT_SESSION_KEY] = True but once in 5
times or so it gives the above mentioned error.


On May 30, 4:59 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Tue, May 27, 2008 at 3:58 AM, Mayank Dhingra <[EMAIL PROTECTED]>
> wrote:
>
>
>
>
>
> > I am experiencing a strange problem while using
> > DualSessionMiddleware
>
> >http://code.djangoproject.com/wiki/CookBookDualSessionMiddleware
>
> > I've done as directed and in most cases the feature works as expected.
> > When the request.post contains the "remember me" i set
>
> > request.session[settings.PERSISTENT_SESSION_KEY] = True
>
> > but for some cases  about 15-20%  while doing so i get this error
>
> > UnboundLocalError: local variable 'settings' referenced before
> > assignment
>
> > Could you suggest what am I doing wrong .?
>
> Does the traceback show that the line you quote is the one that is causing
> the UnboundLocalError?
>
> What is the environment (dev server, Apache, ?) where the error occurs?
>
> You say 15-20% of the time it fails -- can you see any pattern to when it
> fails vs. when it works?
>
> Pasting the full traceback and code in question out on dpaste may help
> someone see what might be going wrong.
>
> Karen
--~--~-~--~~~---~--~~
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: problem in remember me feature

2008-05-30 Thread Karen Tracey
On Tue, May 27, 2008 at 3:58 AM, Mayank Dhingra <[EMAIL PROTECTED]>
wrote:

>
> I am experiencing a strange problem while using
> DualSessionMiddleware
>
> http://code.djangoproject.com/wiki/CookBookDualSessionMiddleware
>
> I've done as directed and in most cases the feature works as expected.
> When the request.post contains the "remember me" i set
>
> request.session[settings.PERSISTENT_SESSION_KEY] = True
>
> but for some cases  about 15-20%  while doing so i get this error
>
> UnboundLocalError: local variable 'settings' referenced before
> assignment
>
>
> Could you suggest what am I doing wrong .?
>

Does the traceback show that the line you quote is the one that is causing
the UnboundLocalError?

What is the environment (dev server, Apache, ?) where the error occurs?

You say 15-20% of the time it fails -- can you see any pattern to when it
fails vs. when it works?

Pasting the full traceback and code in question out on dpaste may help
someone see what might be going wrong.

Karen

--~--~-~--~~~---~--~~
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: problem in remember me feature

2008-05-30 Thread Mayank Dhingra

any suggestions/thoughts ?

On May 27, 11:46 pm, Mayank Dhingra <[EMAIL PROTECTED]> wrote:
> yes,
>
> i've imported settings.
>
> from django.conf import settings
>
> On May 27, 9:52 pm, Sebastian Bauer <[EMAIL PROTECTED]> wrote:
>
> > did you have this:
>
> > import settings
>
> > in files where you using settings variable?
>
> > Mayank Dhingra pisze:
>
> > > any thoughts ?
>
> > > On May 27, 12:58 pm, Mayank Dhingra <[EMAIL PROTECTED]> wrote:
>
> > >> I am experiencing a strange problem while using
> > >> DualSessionMiddleware
>
> > >>http://code.djangoproject.com/wiki/CookBookDualSessionMiddleware
>
> > >> I've done as directed and in most cases the feature works as expected.
> > >> When the request.post contains the "rememberme" i set
>
> > >> request.session[settings.PERSISTENT_SESSION_KEY] = True
>
> > >> but for some cases  about 15-20%  while doing so i get this error
>
> > >> UnboundLocalError: local variable 'settings' referenced before
> > >> assignment
>
> > >> Could you suggest what am I doing wrong .?
--~--~-~--~~~---~--~~
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: problem in remember me feature

2008-05-27 Thread Mayank Dhingra

yes,

i've imported settings.

from django.conf import settings

On May 27, 9:52 pm, Sebastian Bauer <[EMAIL PROTECTED]> wrote:
> did you have this:
>
> import settings
>
> in files where you using settings variable?
>
> Mayank Dhingra pisze:
>
> > any thoughts ?
>
> > On May 27, 12:58 pm, Mayank Dhingra <[EMAIL PROTECTED]> wrote:
>
> >> I am experiencing a strange problem while using
> >> DualSessionMiddleware
>
> >>http://code.djangoproject.com/wiki/CookBookDualSessionMiddleware
>
> >> I've done as directed and in most cases the feature works as expected.
> >> When the request.post contains the "remember me" i set
>
> >> request.session[settings.PERSISTENT_SESSION_KEY] = True
>
> >> but for some cases  about 15-20%  while doing so i get this error
>
> >> UnboundLocalError: local variable 'settings' referenced before
> >> assignment
>
> >> Could you suggest what am I doing wrong .?
--~--~-~--~~~---~--~~
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: problem in remember me feature

2008-05-27 Thread Sebastian Bauer
did you have this:

import settings

in files where you using settings variable?

Mayank Dhingra pisze:
> any thoughts ?
>
> On May 27, 12:58 pm, Mayank Dhingra <[EMAIL PROTECTED]> wrote:
>   
>> I am experiencing a strange problem while using
>> DualSessionMiddleware
>>
>> http://code.djangoproject.com/wiki/CookBookDualSessionMiddleware
>>
>> I've done as directed and in most cases the feature works as expected.
>> When the request.post contains the "remember me" i set
>>
>> request.session[settings.PERSISTENT_SESSION_KEY] = True
>>
>> but for some cases  about 15-20%  while doing so i get this error
>>
>> UnboundLocalError: local variable 'settings' referenced before
>> assignment
>>
>> Could you suggest what am I doing wrong .?
>> 
> >
>
>   


--~--~-~--~~~---~--~~
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: remember me feature

2007-08-02 Thread SH

> is implementing remember me feature for login is as simple as changing
> the cookies settings in the settings.py? is manipulating of setting.py
> allowed in views?
>

I just incorporated the DualSessionMiddleware into my project. It does
what it says, and didn't break any of my other code.



--~--~-~--~~~---~--~~
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: remember me feature

2007-08-01 Thread Joseph Heck

If you want something that lasts longer than a session (for how-ever
you configured it on your system), then you might consider writing
your own cookie, and checking for it at the relevant places. I don't
use this mechanism for authentication, but as a little additional
personalization touch to remember who's logged in from that browser
previously.

It's not super-obvious, but here's a little snippet example of setting
the cookie:

my_response.set_cookie(key=USER_PERSISTENCE_NAME,
   value=username,
   max_age=None,
   expires=expires,
   domain=settings.SESSION_COOKIE_DOMAIN
)

and getting rid of it:

my_response.delete_cookie(USER_PERSISTENCE_NAME)

and to read it, we added a little to a central Context Processor to
make the data available in all the templates:

ctx['saved_username'] = request.COOKIES.get(USER_PERSISTENCE_NAME, "")




On 8/1/07, JHeasly <[EMAIL PROTECTED]> wrote:
>
> Hey James,
>
> This might get you going in the right direction:
>
> "The default SessionMiddleware that comes with Django lets you pick if
> you want all sessions to be browser-length or persistent, if you want
> to use different types of sessions based on a users preference (e.g.
> the good old "Remember Me" check-box) you're gonna have to write your
> own middleware. ... "
>
> http://code.djangoproject.com/wiki/CookBookDualSessionMiddleware
>
> Hope this helps.
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: remember me feature

2007-08-01 Thread JHeasly

Hey James,

This might get you going in the right direction:

"The default SessionMiddleware that comes with Django lets you pick if
you want all sessions to be browser-length or persistent, if you want
to use different types of sessions based on a users preference (e.g.
the good old "Remember Me" check-box) you're gonna have to write your
own middleware. ... "

http://code.djangoproject.com/wiki/CookBookDualSessionMiddleware

Hope this helps.

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



remember me feature

2007-07-31 Thread james_027

hi,

is implementing remember me feature for login is as simple as changing
the cookies settings in the settings.py? is manipulating of setting.py
allowed in views?

THanks
james


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