You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there,
as i've not found patch submissions or just ideas submission, i just post
here something that perhaps could help.
in DjangoAuth.py, get_session and get_decoded could be modified in order to
respect more easily django settings (crypt or sha1 encodings, pickle or
database session persistence,...) :
def get_session(self, session_id):
from django.contrib.sessions.models import Session
try:
session = Session.objects.get(session_key=session_id)
except Session.DoesNotExist:
return False, ''
try:
from datetime import datetime
#Has the session expired?
if session.expire_date < datetime.now():
return False, ''
return True, session # here you return session directly
except:
return False, ''
def get_decoded(self, session): # simpler version :)
try:
return session.get_decoded()
except:
return {}
another thing could be done in __init__ in order to get all django settings
and not only some of them (as i used django and moinmoin in merge WSGI
settings, if you connect to moinmoin then go to django, the WSGI process
will only have some of django settings with the current code). As i do not
manage several django on same OS, i have choosen os.environ settings that's
possible if you use only one django instance in your os partition server:
from django.conf import settings
if <your django project parent directory> not in sys.path:
sys.path.append(<your django project parent directory>)
if <your django project directory> not in sys.path:
sys.path.append(<your django project directory>)
import <your django project name>.settings
import os
os.environ['DJANGO_SETTINGS_MODULE'] = '<your django project
name>.settings'
For example :
<your django project parent directory> : /home (where you've used
django-admin.py startproject mysite)
<your django project directory> : /home/mysite
You can also remove third assumptions as i'm using it on windows xp pro if
you just replace in writeLog(*args):
log = open('/<your log path>/djangoAuthMoinMoin.log', 'a')
a best thing will be to set a variable at the begin of the file (like
TMP_LOG=/tmp/ # +++ windows users should set a viable path here). you can
also use logging module.
regards,
bruce vinchon.
Original issue reported on code.google.com by bruce.vi...@gmail.com on 3 Oct 2009 at 6:11
The text was updated successfully, but these errors were encountered:
Bruce, these changes are excellent and were actually necessary to get this
working for me on MoinMoin 1.9.3. There was one additional change that was
necessary for 1.9.3 though:
cookie = Cookie.SimpleCookie(request.saved_cookie)
needs to be:
cookie = Cookie.SimpleCookie(request.cookies)
It took some hacking to figure this all out, but now it works great. Thanks to
Tom and Bruce. Hope to see this get updated someday so others won't have to go
through the same pain w/ the new versions.
Original comment by paul.mue...@gmail.com on 1 Apr 2011 at 7:25
Also, there is a new External Cookie Doc on the MoinMoin site for 1.9.
Hopefully this helps someone:
http://master19.moinmo.in/HelpOnAuthentication/ExternalCookie
Original comment by paul.mue...@gmail.com on 1 Apr 2011 at 7:29
Original issue reported on code.google.com by
bruce.vi...@gmail.com
on 3 Oct 2009 at 6:11The text was updated successfully, but these errors were encountered: