@tornado.gen.coroutine
    def external_portal_description(self, portid, done=False):
        """Load up enough information about an external portal
        to display it.
        Returns an object with world, location, creator, portaldesc,
        and done fields. (The done argument is just passed along.
        This indicates whether the "put into your list" action is complete
        or not.)
        Raises an exception if anything goes wrong.
        """
        portal = yield self.check_external_portal(portid)
        world = yield motor.Op(self.application.mongodb.worlds.find_one,
                               { '_id': portal['wid'] },
                               { 'name':1, 'creator':1 })
        location = yield motor.Op(self.application.mongodb.locations.find_one,
                                  { '_id': portal['locid'] },
                                  { 'name':1 })
        creator = yield motor.Op(self.application.mongodb.players.find_one,
                                 { '_id': world['creator'] },
                                 { 'name':1 })
        portaldesc = yield motor.Op(self.application.mongodb.worldprop.find_one,
                                    { 'wid': portal['wid'],
                                      'locid': portal['locid'],
                                      'key': 'portaldesc' })
        if not portaldesc:
            portaldesc = yield motor.Op(self.application.mongodb.worldprop.find_one,
                                        { 'wid': portal['wid'],
                                          'locid': None,
                                          'key': 'portaldesc' })
        if not portaldesc:
            portaldesc = {
                'val': self.application.twlocalize('message.no_portaldesc') # 'The destination is hazy.'
                }

        portaldesc = portaldesc['val']
        if isinstance(portaldesc, dict) and portaldesc.get('type', None) == 'text':
            portaldesc = portaldesc.get('text', '???')
            
        return types.SimpleNamespace(
            world=world['name'],
            location=location['name'],
            creator=creator['name'],
            portaldesc=portaldesc,
            done=done)
dataset/ETHPy150Open erkyrath/tworld/lib/tweblib/handlers.py/MyHandlerMixin.external_portal_description/original