def addteam_(self, **kwargs): success, serial = self._addteamform.Validate(kwargs) if not success: raise cpy.HTTPRedirect("/admin/addteam?%s" % Form.Encode(serial)) session = Session() team = Team(kwargs['name'], kwargs['thumb'], kwargs['fullsize'], encrypt(kwargs['password']), 1, kwargs['description']) session.save(team) session.commit() session.close() raise cpy.HTTPRedirect("/admin/lsteam/")
def editteam_(self, **kwargs): success, serial = self._editteamform.Validate(kwargs) if not success: raise cpy.HTTPRedirect("/admin/editteam?%s" % Form.Encode(serial)) session = Session() #TODO: load the team, see what's different, and change those fields team = session.query(Team).filter_by(id=kwargs["team_id"]).first() if team.name != kwargs["name"]: team.name = kwargs.name if team.description != kwargs["description"]: team.description = kwargs["description"] if team.fullsize != kwargs["fullsize"]: team.fullsize = kwargs["fullsize"] if "password" in kwargs: team.password = encrypt(kwargs["password"]) session.commit() session.close() raise cpy.HTTPRedirect("/admin/lsteam/")