@tornado.gen.coroutine
    def check_external_portal(self, portid):
        """Check to make sure a portal is okay for external linking.
        (This lives here because a couple of different handlers use it.)
        Returns the portal DB object, or raises an exception.
        """
        portal = yield motor.Op(self.application.mongodb.portals.find_one,
                                { '_id':portid })
        if not portal:
            raise tornado.web.HTTPError(403, 'No such portal')
        if portal['iid'] is not None:
            raise tornado.web.HTTPError(403, 'Portal is not world-level')
        if portal['scid'] < 'same':
            raise tornado.web.HTTPError(403, 'Portal is current-scope')
        
        plist = yield motor.Op(self.application.mongodb.portlists.find_one,
                               { '_id':portal['plistid'] })
        if not plist:
            raise tornado.web.HTTPError(403, 'No such portlist')
        if plist['type'] != 'world':
            raise tornado.web.HTTPError(403, 'Portlist is not world-level')
        if not plist.get('external', False):
            raise tornado.web.HTTPError(403, 'Portlist is not available for external linking')

        world = yield motor.Op(self.application.mongodb.worlds.find_one,
                               { '_id':portal['wid'] },
                               { 'copyable':1 })
        if not world:
            raise tornado.web.HTTPError(403, 'No such world')
        if not world.get('copyable', False):
            raise tornado.web.HTTPError(403, 'World is not copyable')
        
        return portal
dataset/ETHPy150Open erkyrath/tworld/lib/tweblib/handlers.py/MyHandlerMixin.check_external_portal/operator `==` -> `<`