inventory_views.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:optf2 作者: Lagg 项目源码 文件源码
def GET(self, app, user, cid = None):
        app = models.app_aliases.get(app, app)
        self._cid = cid
        markup.init_theme(app)
        try:
            userp = models.user(user).load()
            pack = models.inventory(userp, scope = app).load()
            items = pack["items"].values()
            equippeditems = {}
            classmap = set()
            slotlist = []
            self._app = app

            markup.set_navlink(markup.generate_root_url("loadout/{0}".format(userp["id64"]), app))

            # initial normal items
            try:
                sitems = models.schema(scope = app).processed_items.values()
                normalitems = views.filtering(sitems).byQuality("normal")
                equippeditems, slotlist, classmap = self.build_loadout(normalitems, equippeditems, slotlist, classmap)
            except models.CacheEmptyError:
                pass

            # Real equipped items
            equippeditems, slotlist, classmap = self.build_loadout(items, equippeditems, slotlist, classmap)

            return template.loadout(app, userp, equippeditems, sorted(classmap), self._slots_sorted + sorted(slotlist), cid)
        except steam.items.InventoryError as E:
            raise web.NotFound(template.errors.generic("Backpack error: {0}".format(E)))
        except steam.user.ProfileError as E:
            raise web.NotFound(template.errors.generic("Profile error: {0}".format(E)))
        except steam.api.HTTPError as E:
            raise web.NotFound(template.errors.generic("Couldn't connect to Steam (HTTP {0})".format(E)))
        except models.ItemBackendUnimplemented:
            raise web.NotFound(template.errors.generic("No backend found to handle loadouts for these items"))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号