本文整理汇总了Python中vilya.models.team.Team.gets方法的典型用法代码示例。如果您正苦于以下问题:Python Team.gets方法的具体用法?Python Team.gets怎么用?Python Team.gets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vilya.models.team.Team
的用法示例。
在下文中一共展示了Team.gets方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_and_delete_team
# 需要导入模块: from vilya.models.team import Team [as 别名]
# 或者: from vilya.models.team.Team import gets [as 别名]
def test_add_and_delete_team(self):
team_id = "test_team"
team_name = "测试team"
description = "测试"
n_team = len(Team.gets())
team = Team.add(team_id, team_name, description)
new_n_team = len(Team.gets())
ok_(new_n_team == n_team + 1)
ok_(team_id == team.uid)
team.delete()
new_n_team = len(Team.gets())
ok_(new_n_team == n_team)
示例2: add_team
# 需要导入模块: from vilya.models.team import Team [as 别名]
# 或者: from vilya.models.team.Team import gets [as 别名]
def add_team(request):
user = request.user
if not user:
return request.redirect("/")
uid = request.get_form_var('uid') or ''
name = request.get_form_var('name') or ''
description = request.get_form_var('description') or ''
errors = ""
if request.method == "POST":
teams = Team.gets()
team_uid_pattern = re.compile(r'[a-zA-Z0-9\_]*')
if not uid:
error = 'uid_not_exists'
elif not name:
error = 'name_not_exists'
elif uid != re.findall(team_uid_pattern, uid)[0]:
error = 'invilid_uid'
elif uid in [team.uid for team in teams]:
error = 'uid_existed'
elif User.check_exist(uid):
error = 'user_id_existed'
elif name in [team.name for team in teams]:
error = 'name_existed'
else:
team = Team.add(uid, name, description)
if team:
team_created_signal.send(user.name,
team_name=team.name,
team_uid=team.uid)
team.add_user(user, TEAM_OWNER)
return request.redirect(team.url)
return st('/teams/add_team.html', **locals())
示例3: settings
# 需要导入模块: from vilya.models.team import Team [as 别名]
# 或者: from vilya.models.team.Team import gets [as 别名]
def settings(self, request):
user = request.user
team = Team.get_by_uid(self.team_uid)
if not team:
raise TraversalError
projects = team.projects
input_uid = request.get_form_var("uid", "")
input_name = request.get_form_var("name", "")
input_description = request.get_form_var("description", "")
error = ""
if request.method == "POST":
if not user:
return request.redirect("/")
if not team.is_owner(user.name):
return request.redirect(team.url)
teams = Team.gets()
team_uid_pattern = re.compile(r"[a-zA-Z0-9\_]*")
if not input_uid:
error = "uid_not_exists"
elif not input_name:
error = "name_not_exists"
elif input_uid != re.findall(team_uid_pattern, input_uid)[0]:
error = "invilid_uid"
elif input_uid in [t.uid for t in teams] and team.uid != input_uid:
error = "uid_existed"
elif input_name in [t.name for t in teams] and team.name != input_name:
error = "name_existed"
else:
team.update(input_uid, input_name, input_description)
return request.redirect("/hub/team/%s/settings" % input_uid)
return st("/teams/team_settings.html", **locals())
示例4: _q_index
# 需要导入模块: from vilya.models.team import Team [as 别名]
# 或者: from vilya.models.team.Team import gets [as 别名]
def _q_index(self, request):
page = request.get_form_var('page', 1)
start = TEAMS_COUNT_PER_PAGE * (int(page) - 1)
teams = Team.gets_by_page(start=start, limit=TEAMS_COUNT_PER_PAGE)
total_teams = len(Team.gets())
n_pages = (total_teams - 1) / TEAMS_COUNT_PER_PAGE + 1 if total_teams else 1 # noqa
return st('/teams/teams.html', **locals())
示例5: test_new_team_issue_participant_count
# 需要导入模块: from vilya.models.team import Team [as 别名]
# 或者: from vilya.models.team.Team import gets [as 别名]
def test_new_team_issue_participant_count(self):
app = TestApp(M.app)
for team in Team.gets():
if team:
team.delete()
team = Team.add("test_team", "test team", "test")
issue = TeamIssue.add('test', 'test description', 'test', team=team.id)
resp = app.get(issue.url)
assert resp.status_int == 200
assert 'Issues' in resp.body
assert '<strong>1</strong> participant' in resp.text
assert '<strong>1</strong> participants' not in resp.text
示例6: main
# 需要导入模块: from vilya.models.team import Team [as 别名]
# 或者: from vilya.models.team.Team import gets [as 别名]
def main():
public_feed = get_public_feed()
public_feed_v2 = get_public_feed_v2()
feeds = public_feed.get_actions()
for feed in feeds:
date = datetime.strptime(feed['date'], "%Y-%m-%d %H:%M:%S")
feed['date'] = date
public_feed_v2.add_action(feed)
print "updated %s public feeds." % len(feeds)
teams = Team.gets()
for team in teams:
team_feed = get_team_feed(team.id)
team_feed_v2 = get_team_feed_v2(team.id)
feeds = team_feed.get_actions()
for feed in feeds:
date = datetime.strptime(feed['date'], "%Y-%m-%d %H:%M:%S")
feed['date'] = date
team_feed_v2.add_action(feed)
print "updated %s team %s feeds." % (len(feeds), team.name)
user_inbox_keys = rds.keys('feed:private:user:v1:*')
for key in user_inbox_keys:
_, _, _, _, user = key.split(':')
user_feed = get_user_inbox(user)
user_feed_v2 = get_user_inbox_v2(user)
feeds = user_feed.get_actions()
for feed in feeds:
date = datetime.strptime(feed['date'], "%Y-%m-%d %H:%M:%S")
feed['date'] = date
user_feed_v2.add_action(feed)
print "updated %s user %s inbox feeds." % (len(feeds), user)
user_feed_keys = rds.keys('feed:public:user:v1:*')
for key in user_feed_keys:
_, _, _, _, user = key.split(':')
user_feed = get_user_feed(user)
user_feed_v2 = get_user_feed_v2(user)
feeds = user_feed.get_actions()
for feed in feeds:
date = datetime.strptime(feed['date'], "%Y-%m-%d %H:%M:%S")
feed['date'] = date
user_feed_v2.add_action(feed)
print "updated %s user %s feeds." % (len(feeds), user)
示例7: _q_index
# 需要导入模块: from vilya.models.team import Team [as 别名]
# 或者: from vilya.models.team.Team import gets [as 别名]
def _q_index(self, request):
user = request.user
project = self.project
if request.method == 'GET':
teams = Team.gets()
owner = User(self.project.owner_id)
committers = project.get_committers_by_project(project.id)
if project.fork_from:
fork_from = CodeDoubanProject.get(project.fork_from)
return st('settings/main.html', **locals())
elif request.method == 'POST':
if user.name == project.owner_id:
summary = request.get_form_var('summary', '')
product = request.get_form_var('product', '')
intern_banned = request.get_form_var('intern_banned', None)
project.update(summary, product, self.proj_name, intern_banned)
return request.redirect('/%s/settings' % self.proj_name)