Git Product home page Git Product logo

Comments (5)

bdarnell avatar bdarnell commented on June 16, 2024

Hmm, I've never seen that and I'm not quite sure how you'd get there. Are you overriding RequestHandler._execute somehow?

from tornado.

bhch avatar bhch commented on June 16, 2024

What you've written is unnecessarily complicated and, not to mention, results in error.

Instead of patching RequestHandler._execute method, you should instead perform the authentication checks in the RequestHandler.prepare method of the base class.

from tornado.

dryalcinmehmet avatar dryalcinmehmet commented on June 16, 2024

Hi,
Thank you for comment, the codes are not solid I know that, I am new in the project, I wanna figure out the issue, can you refactor any part for me?

from tornado.

piraz avatar piraz commented on June 16, 2024

On the file provided by @dryalcinmehmet, there is an options method decorated with tornado.gen.coroutine, no yields just returns. Should that the be source of the _NullFuture?

from tornado.

bdarnell avatar bdarnell commented on June 16, 2024

there is an options method decorated with tornado.gen.coroutine, no yields just returns. Should that the be source of the _NullFuture?

No, tornado.gen.coroutine should still use a real future in this case.

I don't see exactly where the _NullFuture is coming from, but this interceptor decorator is problematic in a number of ways. Wrapping _execute without actually calling the underlying _execute method is probably going to break something, as is discarding the return value of the real _execute method.

I agree with @bhch that you should not be overriding _execute here and should do your auth checks in prepare() instead. We previously kinda-supported overriding _execute because prepare couldn't be asynchronous, but now that we support coroutines in prepare there's no reason to override _execute any more and you should stay away from it.

from tornado.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.