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 7025711
In Process

The Archive Base Latest Questions

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

Sorry if the question sounds naive. I have a cheetah template, e.g: #filter None

  • 0

Sorry if the question sounds naive. I have a cheetah template, e.g:

#filter None
<html>
<body>
$none should be ''
$number should be '1'
</body>
</html>
#end filter

with namespace = {'none': None, 'number': 1}
So basically I want to convert all None and non-string values to ” and string respectively. According to Cheetah’s doc: http://www.cheetahtemplate.org/docs/users_guide_html_multipage/output.filter.html , what I want is the default filter. Isn’t that what I did by putting #filter None at the beginning? How come it doesn’t work?

Please help me get this right. Thanks

EDIT:
To make it clearer, basically I want it to pass this simple if test:

#filter None
<html>
<body>
#if $none == '' and $number == '1':
<b>yay</b>
#end if
</body>
</html>
#end filter

So if it works out all i should see is yay

  • 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:00:46+00:00Added an answer on May 28, 2026 at 12:00 am

    To explain the results you’re getting, let’s define this:

    def filter_to_string(value):
        if value is None:
            return ''
        return str(value)
    

    Let’s imagine that’s our filter. Now, let’s be naïve about how Cheetah does the processing (it’s a bit more involved than this). The result you’re getting would come from this:

    >>> "<html>\n<body>\n" + \
        filter_to_string(ns['none']) + " should be ''\n" + \
        filter_to_string(ns['number']) + " should be '1'\n</body>\n</html>\n"
    "<html>\n<body>\n should be ''\n1 should be '1'\n</body>\n</html>\n"
    

    where ns would be the namespace.

    Given that, does your result still surprises you?

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

Sidebar

Related Questions

Sorry if my question sounds weird lol I'll try to explain. I have 4
Hi im a beginner so sorry for my question if it sounds naive. I
Hi im a beginner so sorry for my question if it sounds naive. I
I am sorry, if this question sounds stupid, but I have searched a lot
Sorry if this question sounds stupid, but I only know HTML/CSS and so I'm
First of all Sorry if my question title sounds stupid.... I have the following
Sorry for the question it might sounds stupid, But: how do you activate a
I am sorry if this is a dumb question (cause it sounds unlikely). I
Sorry if this sounds like a really silly question. But I Googled the web
currently i'm studying MySQL, sorry for my newbie question. Here my question I have

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.