def get_team(state):
 redirect = state[u'website'].redirect
 request = state[u'request']
 user = state[u'user']
 slug = request.line.uri.path[u'team']
 qs = request.line.uri.querystring
 from gratipay.models.team import Team
 team = Team.from_slug(slug)
 if (team is None):
  from gratipay.models.participant import Participant
  participant = Participant.from_username(slug)
  if (participant is not None):
   qs = ((u'?' + request.qs.raw) if request.qs.raw else u'')
   redirect(((u'/~' + request.path.raw[1:]) + qs))
  raise Response(404)
 canonicalize(redirect, request.line.uri.path.raw, u'/', team.slug, slug, qs)
 if (team.is_closed and (not user.ADMIN)):
  raise Response(410)
 return team

def get_team ( state ) : redirect = state [ u'website' ] . redirect request = state [ u'request' ] user = state [ u'user' ] slug = request . line . uri . path [ u'team' ] qs = request . line . uri . querystring from gratipay . models . team import Team team = Team . from_slug ( slug ) if ( team is None ) : from gratipay . models . participant import Participant participant = Participant . from_username ( slug ) if ( participant is not None ) : qs = ( ( u'?' + request . qs . raw ) if request . qs . raw else u'' ) redirect ( ( ( u'/~' + request . path . raw [ 1 : ] ) + qs ) ) raise Response ( 404 ) canonicalize ( redirect , request . line . uri . path . raw , u'/' , team . slug , slug , qs ) if ( team . is_closed and ( not user . ADMIN ) ) : raise Response ( 410 ) return team
returns the team that the commentable_id belongs to if it exists .