Closed tinvaan closed 10 years ago
Interesting... Can anyone verify that this is a regression in the code? Varrun, perhaps :) ?
Could you please list the exact steps you used to reproduce this issue?
Well , I made changes in the assessment/views.py that removed the syntax error that @swiftarrow had pointed out . Then I tried running the app and I faced this error . I then switched to my other git branches and again got the same error. I finally ran a git pull from the repo and once again tried running the application but I still got the same error.
Can you confirm that this is the same issue you faced? (Note: for future reference - exact steps means, commands, URLs navigated, stacktrace etc.)
The following stacktrace is observed Environment:
Request Method: GET Request URL: http://127.0.0.1:8000/crisis/
Django Version: 1.4.3 Python Version: 2.7.3 Installed Applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'crisis', 'refugeecenter', 'person', 'assessment', 'resources', 'bootstrap_toolkit', 'haystack') Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware')
Traceback: File "/home/varrunr/.virtualenvs/CrisisComm/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
Exception Type: KeyError at /crisis/ Exception Value: 'loggedInside'
OK, so here is the issue. The app behaves in such a way that once a user logs in, the key "loggedInside" is set to True. On subsequent views, the key "loggedInside" is being checked with the statement
if request.session['loggedInside'] == True: .... ....
If the session is invalidated and the key no longer exists, trying to access the value of that non-existent key generates a KeyError. This must either be
loginVar = request.session.get('loggedInside');
if not (loginVar == None) and loginVar == "True":
....
....
(OR)
try:
if request.session['loggedInside'] == True:
.....
.....
except KeyError:
return HttpResponseRedirect('/')
Pushed fix, reopen if issue is different or fix is insufficient.
Varrun, thanks for the detailed explanation!
@varrunr , I never encountered the error that you mentioned . Here are the exact steps .
1.Navigate to the project directory/webapp (locally) . 2.Switch to 'bash' (I use zsh) 3.Then run the server by entering the commands (i) workon crisis (ii)python manage.py runserver
4.Navigate to http://127.0.0.1:8000/crisis 5.Click any random point and choose "Assess Road" from the menu that pops up . 6.In the Road Assessment form , the "latitude" and "longitude" are filled in by default . Now fill in the "Assessment Level" and comments. 7.Click on "Enter" 8.Now , I'm navigated to a blank Road Assessment form . Even if I try to fill the form manually , it again redirects me to a blank Road Assessment form . 9.To be doubly sure , I did a git pull using -> "git pull upstream master" where upstream is https://github.com/WiseEarthTechnology/CrisisCommunicator.git
10.I tried running again , following the same procedure mentioned above but I still encounter the same glitch .
I don't get any error messages , I believe it's a bug .
Is anyone else facing this issue ? I hope this was clear enough :)
Thanks
@harishnavnit Thanks for the clarification, looks like the issue I found was different. I am unable to reproduce the issue as you stated. I followed steps 1-7, but after step 7 I see a balloon created on the map with the info I put into the form, i.e. it does not redirect me to a blank form as you said(screenshot attached). Can you paste the ouput of git reflog and git branch?
However, if I do click on the "Road Assessment" link again, it redirects me to a blank form, which I suspect should not happen. The user must be allowed to "edit" the assessment instead of adding a new one. I'm not sure if @bithin and @seshagiriprabhu implemented an edit feature, have you?
Okay , here's the output of "git reflog" : http://pastebin.ubuntu.com/6704232/ and "git branch" : http://pastebin.ubuntu.com/6704272/ .
And No , I could've never implemented an edit feature ! :-)
Ok since your fix issue #17 was not actually merged into master, it's probably a problem in your branch. From the output of your git reflog, I see you didn't take my suggestion of starting off on a new clone. Can you paste the stack trace of the error you are facing?
Oh , I didn't start off from a new clone . What I did was just creating a new git branch and then ran a git pull from upstream master . I thought that would give me the latest code anyway . So , you want me to clone the entire code and build again ??
Yes, if possible. If you face the same problem on a fresh clone then there is an issue, else it's some change you made that is causing the problem. If you still see an error, paste the stack trace.
On Monday, January 6, 2014, R.Harish Navnit wrote:
Oh , I didn't start off from a new clone . What I did was just creating a new git branch and then ran a git pull from upstream master . I thought that would give me the latest code anyway . So , you want me to clone the entire code and build again ??
— Reply to this email directly or view it on GitHubhttps://github.com/WiseEarthTechnology/CrisisCommunicator/issues/22#issuecomment-31669228 .
Sent from Mobile device, Pardon any typos
Sure , I'll try it out ASAP :+1:
I did a fresh install on another system and checked the problem . It still exists for me . I'm listing the exact steps here :
1.Navigate to http://127.0.0.1:8000 2.Click on any random point and choose the Road Assessment option from the menu that pops up. 3.Fill the Road Assessment form
P.S : Sometimes when I follow these steps I'm lead back to the running app. Sorry for posting the entire page screenshot , did it in a hurry.
So I guess , there's an Issue .
Well, I just did a fresh install myself, and I am not facing any issue, I'm able to add a road assessment just fine. It looks like there is no bug. Maybe, @swiftarrow can verify as well. @harishnavnit , what environment are you using - OS, Django, python etc.?
Here are the details . OS : Ubuntu 12.04 LTS Python : python 2.7.3
and when I try to check my django version , I get the following error message : http://pastebin.ubuntu.com/6731894/
But ofcourse , django version mentioned in the webapp/requirements.txt is 1.4.3
@harishnavnit are you using virtualenv for Django? I didn't see the virtualenv in that terminal output.
I had just verified that there are no problems creating or deleting Assess Road in Harish's Issue#17 branch.
Oh yes , @swiftarrow , thanks for correcting me . I am indeed using virtualenv and now I get the output "1.4.3" , as expected . http://pastebin.ubuntu.com/6732073/
Cool! :thumbsup:
Can I close this issue ? Has anyone verified this ?
@Harish, I verified on your ISSUE #17 branch that creating the Assess Road object did work, as did deleting it.
Thanks, Love, Peace, Link
On Sun, Jan 12, 2014 at 7:40 AM, R.Harish Navnit notifications@github.comwrote:
Can I close this issue ? Has anyone verified this ?
— Reply to this email directly or view it on GitHubhttps://github.com/WiseEarthTechnology/CrisisCommunicator/issues/22#issuecomment-32116553 .
Thanks . I'm closing this . If any issue pops up , do reopen this :)
I working on the bug that I had reported earlier but now I've stumbled upon this new issue . Earlier I was able to create a database but unable to delete the same after creation. Now I'm unable to create a "Asses Road" database , let alone delete one .