Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7029411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:32:08+00:00 2026-05-28T00:32:08+00:00

Whenever I POST a form, I display error messages. However, the way I add

  • 0

Whenever I POST a form, I display error messages. However, the way I add flashes to the queue, some messages stay after I POST to the form, and some don’t. I noticed that it’s due to the way I add messages to the queue.

The regular way that works perfectly:

post_data = request.POST
if 'submit' in post_data:
    ... function(post_data) ...
    if ...:
        request.session.flash(u'This is some error message')
    request.session.flash(u'Maybe some other error message')

And in the mako file:

<html>...<body>...
% for m in request.session.pop_flash():
  <div class="alert-message">
    <p>${m}</p>
  </div>
% endfor
...</body></html>

However, the way I want some of the messages to work is:

if 'submit' in post_data: 
    messages = function(...) # output is always a list
    for m in messages:
        request.session.flash(m)

When I do that, every time I rePOST to the same form, ALL the previous messages are added to the .flash() again. Thus, the error messages just keep piling. How do I fix this or work around this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T00:32:09+00:00Added an answer on May 28, 2026 at 12:32 am

    I figured out the problem, but I’m not sure why it happened. Before, I initiated message as a keyword:

    @classmethod
    def validate(cls, message=[], **kwargs):
        if this:
            message.append(u'...')
        return kwargs, message
    

    I believe that after each POST, message didn’t clear even though I never called validate() with it. However, when I removed messsage as a keyword, it works fine:

    @classmethod
    def validate(cls, **kwargs):
        message = []
        ...
    

    Anyone know why this is the case?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a form where I need to dynamically add inputs whenever the
This data comes from a POST form, the idea is to simply add more
I have a Dojo front-ended web application. Whenever I try to post a form
I know you should use POST whenever data will be modified on a public
Whenever I design a database, I always wonder if there is a best way
Whenever I try to add a new project to my SourceSafe repository it creates
Whenever I run any jython program in Eclipse, I got the following error in
I have some text in a link title and also a form box and
I have set the enctype to: multipart/form-data yet whenever I submit this form, the
I'm trying to add a new FilteringSelect widget dynamically to a preexisting form I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.