inventory_views.py 文件源码

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

项目:optf2 作者: Lagg 项目源码 文件源码
def GET(self, app, iid):
        user = None

        markup.init_theme(app)

        try:
            sitems = models.schema(scope = app).processed_items
            item = sitems[iid]

            if web.input().get("contents"):
                contents = item.get("contents")
                if contents:
                    item = contents
        except steam.api.HTTPError as E:
            raise web.NotFound(template.errors.generic("Couldn't connect to Steam (HTTP {0})".format(E)))
        except steam.items.SchemaError as E:
            raise web.NotFound(template.errors.generic("Couldn't open schema: {0}".format(E)))
        except KeyError:
            raise web.NotFound(template.item_error_notfound(iid))
        except models.CacheEmptyError as E:
            raise web.NotFound(template.errors.generic(E))
        except models.ItemBackendUnimplemented:
            raise web.NotFound(template.errors.generic("No backend found to handle the given item, this could mean that the item has no available associated schema (yet)"))

        caps = markup.get_capability_strings(item.get("caps", []))

        try:
            assets = models.assets(scope = app).price_map
            price = markup.generate_item_price_string(item, assets)
        except models.CacheEmptyError:
            price = None

        # Strip off quality prefix for possessive name
        itemname = item["mainname"]
        if itemname.startswith("The "):
            item["ownedname"] = itemname[4:]
        else:
            item["ownedname"] = itemname

        return template.item(app, user, item, price = price, caps = caps)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号