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

Python reposadocommon.writeCatalogBranches函数代码示例

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

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



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

示例1: process_queue

def process_queue():
    queue = json.loads(request.form['queue'])

    catalog_branches = reposadocommon.getCatalogBranches()
    
    for cat in queue['listing']:
	if cat not in catalog_branches.keys():
	    print 'No such catalog'
	    continue
	    
	for prodid in queue['listing'][cat]:
	    if prodid not in catalog_branches[cat]:
		# TODO: check for actual prodid?
		print 'Adding product',prodid,'to cat',cat
		catalog_branches[cat].append(prodid)

    for cat in queue['delisting']:
	if cat not in catalog_branches.keys():
	    print 'No such catalog'
	    continue
	    
	for prodid in queue['delisting'][cat]:
	    if prodid in catalog_branches[cat]:
		print 'Removing product',prodid,'from cat',cat
		catalog_branches[cat].remove(prodid)

    reposadocommon.writeCatalogBranches(catalog_branches)
    reposadocommon.writeAllBranchCatalogs()

    
    return jsonify(result=True);
开发者ID:timsutton,项目名称:margarita,代码行数:31,代码来源:margarita.py


示例2: process_queue

def process_queue():
    catalog_branches = reposadocommon.getCatalogBranches()

    for change in request.json:
        prodId = change['productId']
        branch = change['branch']

        if branch not in catalog_branches.keys():
            print 'No such catalog'
            continue

        if change['listed']:
            # if this change /was/ listed, then unlist it
            if prodId in catalog_branches[branch]:
                print 'Removing product %s from branch %s' % (prodId, branch, )
                catalog_branches[branch].remove(prodId)
        else:
            # if this change /was not/ listed, then list it
            if prodId not in catalog_branches[branch]:
                print 'Adding product %s to branch %s' % (prodId, branch, )
                catalog_branches[branch].append(prodId)

    print 'Writing catalogs'
    reposadocommon.writeCatalogBranches(catalog_branches)
    reposadocommon.writeAllBranchCatalogs()

    return jsonify(result=True)
开发者ID:joshua-d-miller,项目名称:margarita,代码行数:27,代码来源:margaritaauth-template.py


示例3: process_queue

def process_queue():
    queue = json.loads(request.form["queue"])

    catalog_branches = reposadocommon.getCatalogBranches()

    for cat in queue["listing"]:
        if cat not in catalog_branches.keys():
            print "No such catalog"
            continue

        for prodid in queue["listing"][cat]:
            if prodid not in catalog_branches[cat]:
                # TODO: check for actual prodid?
                print "Adding product", prodid, "to cat", cat
                catalog_branches[cat].append(prodid)

    for cat in queue["delisting"]:
        if cat not in catalog_branches.keys():
            print "No such catalog"
            continue

        for prodid in queue["delisting"][cat]:
            if prodid in catalog_branches[cat]:
                print "Removing product", prodid, "from cat", cat
                catalog_branches[cat].remove(prodid)

    reposadocommon.writeCatalogBranches(catalog_branches)
    reposadocommon.writeAllBranchCatalogs()

    return jsonify(result=True)
开发者ID:kenergy,项目名称:margarita,代码行数:30,代码来源:margarita.py


示例4: new_branch

def new_branch(branchname):
    catalog_branches = reposadocommon.getCatalogBranches()
    if branchname in catalog_branches:
        reposadocommon.print_stderr('Branch %s already exists!', branchname)
        abort(401)
    catalog_branches[branchname] = []
    reposadocommon.writeCatalogBranches(catalog_branches)

    return jsonify(result='success')
开发者ID:joshua-d-miller,项目名称:margarita,代码行数:9,代码来源:margaritaauth-template.py


示例5: add_all

def add_all(branchname):
    products = reposadocommon.getProductInfo()
    catalog_branches = reposadocommon.getCatalogBranches()

    catalog_branches[branchname] = products.keys()

    reposadocommon.writeCatalogBranches(catalog_branches)
    reposadocommon.writeAllBranchCatalogs()

    return jsonify(result=True)
开发者ID:joshua-d-miller,项目名称:margarita,代码行数:10,代码来源:margaritaauth-template.py


示例6: dup

def dup(frombranch, tobranch):
	catalog_branches = reposadocommon.getCatalogBranches()

	if frombranch not in catalog_branches.keys() or tobranch not in catalog_branches.keys():
		print 'No branch ' + branchname
		return jsonify(result=False)

	catalog_branches[tobranch] = catalog_branches[frombranch]

	print 'Writing catalogs'
	reposadocommon.writeCatalogBranches(catalog_branches)
	reposadocommon.writeAllBranchCatalogs()

	return jsonify(result=True)
开发者ID:jessepeterson,项目名称:margarita,代码行数:14,代码来源:margarita.py


示例7: dup_apple

def dup_apple(branchname):
    catalog_branches = reposadocommon.getCatalogBranches()

    if branchname not in catalog_branches.keys():
        print 'No branch ' + branchname
        return jsonify(result=False)

    # generate list of (non-deprecated) updates
    products = reposadocommon.getProductInfo()
    prodlist = []
    for prodid in products.keys():
        if len(products[prodid].get('AppleCatalogs', [])) >= 1:
            prodlist.append(prodid)

    catalog_branches[branchname] = prodlist

    print 'Writing catalogs'
    reposadocommon.writeCatalogBranches(catalog_branches)
    reposadocommon.writeAllBranchCatalogs()

    return jsonify(result=True)
开发者ID:joshua-d-miller,项目名称:margarita,代码行数:21,代码来源:margaritaauth-template.py


示例8: delete_branch

def delete_branch(branchname):
    catalog_branches = reposadocommon.getCatalogBranches()
    if not branchname in catalog_branches:
        reposadocommon.print_stderr("Branch %s does not exist!", branchname)
        return

    del catalog_branches[branchname]

    # this is not in the common library, so we have to duplicate code
    # from repoutil
    for catalog_URL in reposadocommon.pref("AppleCatalogURLs"):
        localcatalogpath = reposadocommon.getLocalPathNameFromURL(catalog_URL)
        # now strip the '.sucatalog' bit from the name
        if localcatalogpath.endswith(".sucatalog"):
            localcatalogpath = localcatalogpath[0:-10]
        branchcatalogpath = localcatalogpath + "_" + branchname + ".sucatalog"
        if os.path.exists(branchcatalogpath):
            reposadocommon.print_stdout("Removing %s", os.path.basename(branchcatalogpath))
            os.remove(branchcatalogpath)

    reposadocommon.writeCatalogBranches(catalog_branches)

    return jsonify(result=True)
开发者ID:kenergy,项目名称:margarita,代码行数:23,代码来源:margarita.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python repository.Repository类代码示例发布时间:2022-05-26
下一篇:
Python reposadocommon.getCatalogBranches函数代码示例发布时间: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