tickets.py 文件源码

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

项目:Tktr 作者: Intuity 项目源码 文件源码
def retract_addon_view(self):
        ticket_type = None
        addon = None
        if "tick_code" in self.request.matchdict:
            types = [x.tick_type for x in self.request.root.ticket_pools.values() if x.tick_type.__name__ == self.request.matchdict["tick_code"]]
            ticket_type = types[0]
        if "addon_code" in self.request.matchdict:
            addon_code = self.request.matchdict["addon_code"]
            if addon_code in ticket_type.addons:
                addon = ticket_type.addons[addon_code]
            else:
                self.request.session.flash("The requested add-on does not exist and hence was not retracted.", "error")
                return HTTPFound(location=self.request.route_path("admin_tickets_addons", tick_code=ticket_type.__name__))
        addon.unlimited = False
        addon.total_released = len(addon.allocated)
        self.request.session.flash('The add-on "%s" has been retracted.' % addon.name, "info")
        return HTTPFound(location=self.request.route_path("admin_tickets_addons", tick_code=ticket_type.__name__))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号