Beispiel #1
0
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)
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)
Beispiel #3
0
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);
Beispiel #4
0
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)
Beispiel #5
0
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)
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)
Beispiel #7
0
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)
Beispiel #8
0
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)
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)
Beispiel #10
0
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)