def sites_for_org():

    try:
        org = request.args[0]
    except:
        result = current.xml.json_message(False, 400, "No Org provided!")
    else:
        try:
            org = int(org)
        except:
            result = current.xml.json_message(False, 400, "Invalid Org provided!")
        else:
            stable = s3db.org_site
            if settings.get_org_branches():
                # Find all branches for this Organisation
                btable = s3db.org_organisation_branch
                query = (btable.organisation_id == org) & \
                        (btable.deleted != True)
                rows = db(query).select(btable.branch_id)
                org_ids = [row.branch_id for row in rows] + [org]
                query = (stable.organisation_id.belongs(org_ids)) & \
                        (stable.deleted != True)
            else:
                query = (stable.organisation_id == org) & \
                        (stable.deleted != True)
            rows = db(query).select(stable.site_id,
                                    stable.name,
                                    orderby=stable.name)
            result = rows.json()
    finally:
        response.headers["Content-Type"] = "application/json"
        return result

# -----------------------------------------------------------------------------
Build a virtualenv bootstrap for developing paver.
dataset/ETHPy150Open sahana/eden/controllers/org.py/sites_for_org--crossover with--dataset/ETHPy150Open paver/paver/pavement.py/bootstrap