• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python project.CodeDoubanProject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中vilya.models.project.CodeDoubanProject的典型用法代码示例。如果您正苦于以下问题:Python CodeDoubanProject类的具体用法?Python CodeDoubanProject怎么用?Python CodeDoubanProject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CodeDoubanProject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_create_git_repo

 def test_create_git_repo(self):
     git_path = os.path.join(get_repo_root(), "abc.git")
     CodeDoubanProject.create_git_repo(git_path)
     assert os.path.exists(git_path)
     info_file = os.path.join(git_path, "refs")
     assert os.path.exists(info_file)
     shutil.rmtree(git_path)
开发者ID:leeccong,项目名称:code,代码行数:7,代码来源:test_basic.py


示例2: _q_index

def _q_index(request):
    user = request.user
    my_issues = []
    if user:
        username = user.username

        your_projects = CodeDoubanProject.get_projects(owner=username,
                                                       sortby='lru')
        watched_projects = CodeDoubanProject.get_watched_others_projects_by_user(  # noqa
            user=username,
            sortby='lru')

        teams = Team.get_by_user_id(user.name)
        actions = get_user_inbox(username).get_actions(
            stop=PAGE_ACTIONS_COUNT - 1)
        badge_items = user.get_badge_items()

        # pull request
        # your_tickets = user.get_user_pull_requests_rank(limit=5)
        your_tickets = user.get_user_submit_pull_requests(limit=5)

        # issue
        project_ids = CodeDoubanProject.get_ids(user.name)
        dt = {
            'state': "open",
            'limit': 5,
            'start': 0,
        }
        my_issues = ProjectIssue.gets_by_project_ids(project_ids, **dt)

        return st('newsfeed.html', **locals())
    return request.redirect("/teams/")
开发者ID:000fan000,项目名称:code,代码行数:32,代码来源:__init__.py


示例3: create

    def create(self, request):
        user = request.user
        if not user:
            raise AccessError
        from_proj = request.get_form_var('from_proj')
        from_ref = request.get_form_var('from_ref')
        to_ref = request.get_form_var('to_ref')
        to_proj = request.get_form_var('to_proj')
        title = request.get_form_var('title', '').decode('utf-8')
        comment = request.get_form_var('body', '').decode('utf-8')
        if not all([from_ref, from_proj, to_ref, to_proj]):
            raise TraversalError
        from_proj = CodeDoubanProject.get_by_name(from_proj)
        to_proj = CodeDoubanProject.get_by_name(to_proj)
        if from_proj != to_proj:
            if not from_proj.has_push_perm(user.name):
                raise AccessError(
                    "Need push permission to create PR on another project")

        pullreq = PullRequest.open(from_proj, from_ref, to_proj, to_ref)
        ticket = Ticket(None, None, to_proj.id, title, comment,
                        user.username, None, None)
        pullreq = add_pull(ticket, pullreq, user)
        ticket = pullreq.ticket
        return request.redirect(str('/%s/pull/%s/' % (to_proj.name,
                                                      ticket.ticket_id)))
开发者ID:000fan000,项目名称:code,代码行数:26,代码来源:pull.py


示例4: test_multiple_project_index

 def test_multiple_project_index(self):
     skip_test()
     for i in range(5):
         CodeDoubanProject.add('test%s' % i, 'owner', create_trac=False)
     _reposearch.RepoSearch.index_repos()
     objs = _reposearch.RepoSearch.query_repo_objs()
     assert len(objs) == 5
开发者ID:leeccong,项目名称:code,代码行数:7,代码来源:test_search.py


示例5: test_project_meta_dict

 def test_project_meta_dict(self):
     project_name = "project3"
     owner_id = "testuser"
     summary = "a summary"
     product = "fire"
     project = CodeDoubanProject.add(
         project_name, owner_id, summary, product)
     # hookfile_path = "%s/hooks/post-receive" % project.git_real_path
     project = CodeDoubanProject.get_by_name(project_name)
     data = {
         'url': "%s/%s" % (DOMAIN, project_name),
         'name': project_name,
         'description': summary,
         'product': product,
         'committers_count': 0,
         'forked_count': 0,
         'open_issues_count': 0,
         'open_tickets_count': 0,
         'watched_count': 0,
         'owner': {
             'name': owner_id,
             'avatar': gravatar_url(owner_id + '@douban.com'),
         },
     }
     commits = project.git.get_revisions("HEAD~1", "HEAD")
     if commits:
         data['last_commit'] = commits[0]
     ok_(project.get_info() == data)
     project.delete()
开发者ID:000fan000,项目名称:code,代码行数:29,代码来源:test_project.py


示例6: get_temp_project

def get_temp_project(origin=None, repo_path=BARE_REPO_PATH):
    if origin:
        prefix_path = get_repo_root()
        temp_repo_path = tempfile.mkdtemp(suffix=".git",
                                          prefix="test_",
                                          dir=prefix_path)
        project_name = temp_repo_path[len(prefix_path) + 1:][:-4]
        project = CodeDoubanProject.add(project_name,
                                        TEMP_PROJECT_OWNER,
                                        TEMP_PROJECT_DESCRIPTION,
                                        fork_from=origin.id,
                                        create_trac=False)
        return project

    prefix_path = get_repo_root()
    temp_repo_path = tempfile.mkdtemp(suffix=".git",
                                      prefix="test_",
                                      dir=prefix_path)
    project_name = temp_repo_path[len(prefix_path) + 1:][:-4]
    project = CodeDoubanProject.add(project_name, TEMP_PROJECT_OWNER,
                                    TEMP_PROJECT_DESCRIPTION)

    shutil.rmtree(temp_repo_path)
    repo = Jagare(repo_path)
    repo.clone(temp_repo_path, bare=True)

    return project
开发者ID:000fan000,项目名称:code,代码行数:27,代码来源:utils.py


示例7: test_destroy_hook

 def test_destroy_hook(self):
     url = "http://this.is.other.url"
     prj = self._prj()
     hook = CodeDoubanHook.add(url, prj.id)
     hooked_project = CodeDoubanProject.get(hook.project_id)
     assert len(hooked_project.hooks) == 1
     hooked_project = CodeDoubanProject.get(hook.project_id)
     hook.destroy()
     assert len(hooked_project.hooks) == 0
开发者ID:000fan000,项目名称:code,代码行数:9,代码来源:test_hook.py


示例8: test_get_forked_from_should_return_origin_project

 def test_get_forked_from_should_return_origin_project(self):
     prj = CodeDoubanProject.get_by_name('orig')
     prj.delete()
     prj = CodeDoubanProject.get_by_name('fork')
     prj.delete()
     orig = CodeDoubanProject.add('orig', owner_id="test1")
     fork = orig.fork('fork', 'user2')
     source = fork.get_forked_from()
     eq_(source, orig)
开发者ID:000fan000,项目名称:code,代码行数:9,代码来源:test_fork_project.py


示例9: test_project_validate

 def test_project_validate(self):
     noname_project = CodeDoubanProject(
         108, '', "test1", "testuser", datetime.now(), "fire",
         '/fake_path', '/fake_path')
     ok_project = CodeDoubanProject(
         108, 'project6', "testuser", datetime.now(), "test",
         "fire", '/fake_path', '/fake_path')
     ok_(bool(noname_project.validate()))
     ok_(not bool(ok_project.validate()))
开发者ID:000fan000,项目名称:code,代码行数:9,代码来源:test_project.py


示例10: _repo

 def _repo(self, name, bare=True):
     git_path = self._path(name)
     if bare:
         work_tree_path = None
     else:
         work_tree_path = self._path_work_tree(name)
         os.mkdir(work_tree_path)
     CodeDoubanProject.create_git_repo(git_path)
     repo = git.GitRepo(git_path, work_tree=work_tree_path)
     return repo
开发者ID:leeccong,项目名称:code,代码行数:10,代码来源:test_git_commit_one_file.py


示例11: test_create

 def test_create(self):
     git_path = os.path.join(get_repo_root(), 'test_create.git')
     assert not os.path.exists(
         git_path), "git_path should not exist prior repo creation"
     CodeDoubanProject.create_git_repo(git_path)
     assert os.path.exists(
         git_path), "create_git_repo should create git_path"
     refs_file = os.path.join(git_path, 'refs')
     assert os.path.exists(refs_file), \
         "create_git_repo should create a git repo with refs subdir"
开发者ID:mozillazg,项目名称:code,代码行数:10,代码来源:test_git.py


示例12: yours

def yours(request):
    user = request.user
    actions = (get_user_feed(user.username)
               .get_actions(stop=PAGE_ACTIONS_COUNT - 1))

    your_projects = CodeDoubanProject.get_projects(
        owner=user.username, sortby="lru")
    watched_projects = CodeDoubanProject.get_watched_others_projects_by_user(
        user=user.username, sortby='lru')

    badge_items = user.get_badge_items()
    return st('my_actions.html', **locals())
开发者ID:000fan000,项目名称:code,代码行数:12,代码来源:__init__.py


示例13: add_fork_project

 def add_fork_project(project):
     name = "%s/%s" % (project.owner_id, project.name)
     _project = CodeDoubanProject.add(
         name=name, owner_id=project.owner_id, summary=project.summary,
         product=project.product, fork_from=project.fork_from,
         intern_banned=project.intern_banned)
     if _project:
         fork_from_project = CodeDoubanProject.get(project.fork_from)
         _project.update(project.summary,
                         project.product,
                         name,
                         fork_from_project.intern_banned)
     return _project
开发者ID:000fan000,项目名称:code,代码行数:13,代码来源:__init__.py


示例14: test_get_fork_network_should_return_all_projects_with_same_origin

    def test_get_fork_network_should_return_all_projects_with_same_origin(self):  # noqa
        prj = CodeDoubanProject.get_by_name('orig')
        prj.delete()
        orig = CodeDoubanProject.add('orig', owner_id="test1")
        fork = orig.fork('fork1', 'user1')
        fork2 = orig.fork('fork2', 'user2')
        fork3 = fork.fork('fork3', 'user3')

        expected_network = set([orig, fork, fork2, fork3])

        for proj in [orig, fork, fork2, fork3]:
            network = proj.get_fork_network()
            eq_(set(network), expected_network)
开发者ID:000fan000,项目名称:code,代码行数:13,代码来源:test_fork_project.py


示例15: update_repo_indexes

    def update_repo_indexes(cls):
        old_obj_ids = cls.query_repo_objs()
        old_obj_ids = [id for id, in old_obj_ids]
        new_obj_ids = CodeDoubanProject.get_project_ids_sortby_sumup()
        new_objs = CodeDoubanProject.gets(new_obj_ids)
        to_delete_ids = set(old_obj_ids) - set(new_obj_ids)

        cls.delete_repo_indexes(to_delete_ids)

        index_data = [cls.get_repo_index_from_project(project)
                      for project in new_objs]
        indexes = [(data['id'], data) for data in index_data]
        IndexEngine.create_index_bulk('repo', indexes)
开发者ID:000fan000,项目名称:code,代码行数:13,代码来源:repo_search.py


示例16: test_transfer_project

 def test_transfer_project(self):
     pname1 = 'project6'
     pname2 = 'project7'
     proj_owner = 'admin_user'
     to_user = 'testuser1'
     p = CodeDoubanProject.add(pname1, owner_id=proj_owner,
                               summary="test", product="fire")
     _ = CodeDoubanProject.add(pname2, owner_id=proj_owner,
                               summary="test", product="fire")
     p.transfer_to(to_user)
     p1 = CodeDoubanProject.get_by_name(pname1)
     assert p1.owner_id == to_user
     p2 = CodeDoubanProject.get_by_name(pname2)
     assert p2.owner_id == proj_owner
开发者ID:000fan000,项目名称:code,代码行数:14,代码来源:test_project.py


示例17: setup_repos

def setup_repos(tmpdir, prj_name='test_proj'):
    origin_project = CodeDoubanProject.add(prj_name, 1,
                                           create_trac=False)
    path = origin_project.git_real_path
    with clone(path) as workdir:
        with open(os.path.join(workdir, 'origin'), 'w') as f:
            f.write(content_a)
    fork_project = CodeDoubanProject.add(prj_name + '_fork', 2,
                                         fork_from=origin_project.id,
                                         create_trac=False)
    fork_path = fork_project.git_real_path
    repo = origin_project
    fork_repo = fork_project
    return path, repo, fork_path, fork_repo
开发者ID:leeccong,项目名称:code,代码行数:14,代码来源:utils.py


示例18: _repo

 def _repo(self, name, bare=True):
     git_path = self._path(name)
     if bare:
         work_tree_path = None
     else:
         work_tree_path = self._path_work_tree(name)
         if not os.path.exists(work_tree_path):
             os.mkdir(work_tree_path)
     try:
         CodeDoubanProject.create_git_repo(git_path)
     except:
         pass
     repo = git.GitRepo(git_path, work_tree=work_tree_path)
     return repo
开发者ID:sdgdsffdsfff,项目名称:code-1,代码行数:14,代码来源:test_git_commit_one_file.py


示例19: _repo

 def _repo(self, name, bare=True):
     git_path = self._path(name)
     if bare:
         work_tree_path = None
     else:
         work_tree_path = self._path_work_tree(name)
         if os.path.exists(git_path):
             shutil.rmtree(git_path, ignore_errors=True)
         try:
             os.mkdir(work_tree_path)
         except OSError:
             pass
     CodeDoubanProject.create_git_repo(git_path)
     repo = git.GitRepo(git_path, work_tree=work_tree_path)
     return repo
开发者ID:000fan000,项目名称:code,代码行数:15,代码来源:test_diff.py


示例20: test_get_my_projects

 def test_get_my_projects(self):
     project_name = "code"
     product_name = "fire"
     summary = "test"
     owner_id = "xingben"
     for i in range(5):
         delete_project("%s%d" % (project_name, i))
         CodeDoubanProject.add("%s%d" % (project_name, i), owner_id=owner_id, summary=summary, product=product_name)
     api_token = self.create_api_token("xingben")
     ret = self.app.get(
         "/api/user/repos", headers=dict(Authorization="Bearer %s" % api_token.token), status=200
     ).json
     self.assertEquals(len(ret), 5)
     self.assertTrue("name" in ret[0])
     self.assertTrue("description" in ret[0])
开发者ID:sdgdsffdsfff,项目名称:code-1,代码行数:15,代码来源:test_user.py



注:本文中的vilya.models.project.CodeDoubanProject类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python project_issue.ProjectIssue类代码示例发布时间:2022-05-26
下一篇:
Python issue.Issue类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap