本文整理汇总了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);
示例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)
示例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)
示例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')
示例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)
示例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)
示例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)
示例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)