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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:03:57+00:00 2026-06-01T19:03:57+00:00

Basically what I am trying to achieve is check if user is logged in

  • 0

Basically what I am trying to achieve is check if user is logged in and if he’s not he shall be redirected to the /somepage. I am trying to make it by creating a class that extends webapp.RequestHandler and later in code just extend that class.
(something like beforeFilter in cakephp)
If something isn’t clear I’ll explain it :).

  • 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-06-01T19:03:58+00:00Added an answer on June 1, 2026 at 7:03 pm

    use decorators.

    here the documentation:
    http://www.python.org/dev/peps/pep-0318/

    here an example to remove slashes on the request path:

    def removeslash(method):
        """Use this decorator to remove trailing slashes from the request path.
    
        For example, a request to '/foo/' would redirect to '/foo' with this
        decorator. Your request handler mapping should use a regular expression
        like r'/foo/*' in conjunction with using the decorator.
        """
        @functools.wraps(method)
        def wrapper(self, *args, **kwargs):
            if self.request.path.endswith("/"):
                if self.request.method == "GET":
                    uri = self.request.path.rstrip("/")
                    if self.request.query: uri += "?" + self.request.query
                    self.redirect(uri)
                    return
                return self.status(404)
            return method(self, *args, **kwargs)
        return wrapper
    

    and you use it like:

    class MyHandler(RequestHandler):
        @removeslash
        def get(self):
            # your code
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically what I'm trying to achieve is a slide toggle effect but not quite.
Basically what I'm trying to achieve is to make the object reference another object
I'm basically trying to pass a method to another class to be called later,
I'm basically trying to get the target element from event.target and if not equal
I'm basically trying to play with recursions and created a small program that finds
This is what I am ultimately trying to achieve: //When the user clicks the
Basically what I'm trying to achieve is a program which allow users to connect
Basically what I'm trying to achieve is the following:- I have a text box
I am basically trying to achieve what this page has: When clicked on an
I'm trying to achieve a small animated intro to a website. Basically I want

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.