def GET(self, app, user, iid):
markup.init_theme(app)
try:
user, items = models.load_inventory(user, scope = app)
except steam.api.HTTPError as E:
raise web.NotFound(template.errors.generic("Couldn't connect to Steam (HTTP {0})".format(E)))
except steam.user.ProfileError as E:
raise web.NotFound(template.errors.generic("Can't retrieve user profile data: {0}".format(E)))
except steam.items.InventoryError as E:
raise web.NotFound(template.errors.generic("Couldn't open backpack: {0}".format(E)))
item = None
try:
item = items["items"][iid]
except KeyError:
for cid, bpitem in items["items"].iteritems():
oid = bpitem.get("oid")
if oid == long(iid):
item = bpitem
break
if not item:
raise web.NotFound(template.item_error_notfound(iid))
if web.input().get("contents"):
contents = item.get("contents")
if contents:
item = contents
# 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)
评论列表
文章目录