0
1

When I try to submit question where user is authenticated but not email validated, the data (question or answer) is getting lost...

> if request.user.is_authenticated() and
> request.user.email_valid_and_can_ask():
>                     ask_action = AskAction(user=request.user,
> ip=request.META['REMOTE_ADDR']).save(data=form.cleaned_data)
>                     question = ask_action.node
> 
>                     if settings.WIKI_ON and
> request.POST.get('wiki', False):
>                         question.nstate.wiki = ask_action
> 
>                     return HttpResponseRedirect(question.get_absolute_url())
>                 else:
>                     request.session[PENDING_SUBMISSION_SESSION_ATTR]
> = {
>                         'POST': request.POST,
>                         'data_name': _("question"),
>                         'type': 'ask',
>                         'submission_url': reverse('ask'),
>                         'time': datetime.datetime.now()
>                     }
> 
>                     if request.user.is_authenticated():
>                         request.user.message_set.create(message=_("Your
> question is pending until you %s.") %
> html.hyperlink(
>                             reverse('send_validation_email'),
> _("validate your email")
>                         ))
>                         return HttpResponseRedirect(reverse('index'))
>                     else:
>                         return HttpResponseRedirect(reverse('auth_signin'))

Is the feature properly defined befause I don't see that question is stored anywhere to retrive back in main system after user validate email.

Any help would be great.

asked 17 Dec '11, 10:37

nilayparikh's gravatar image

nilayparikh
21135
accept rate: 0%

edited 18 Dec '11, 16:48

Jordan's gravatar image

Jordan ♦♦
3.1k618


I've tried to reproduce the described behavior, but it worked fine for me. The data is stored in session if the user hasn't validated the email and is trying to post a question, you can check that here (line 89, views/writers.py):

request.session[PENDING_SUBMISSION_SESSION_ATTR]

Because data is stored in session, it could get lost if you had tried to log out after posting your question. This would result in cleaning the session and lossing the pending submission data from it. On the next log in the session would be clean and nothing would get posted.

link

answered 17 Dec '11, 11:26

Jordan's gravatar image

Jordan ♦♦
3.1k618
accept rate: 39%

Thanks, later I managed to work. I was expecting that system would persist somewhere in database. This seems to be a bit problematic when you got two or more servers and working with load balanced.

Many thanks again for your efforts.

(18 Dec '11, 13:52) nilayparikh
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×166
×101
×1
×1

Asked: 17 Dec '11, 10:37

Seen: 643 times

Last updated: 18 Dec '11, 16:48

powered by OSQA