Beispiel #1
0
def index(request):
    if request.method == 'GET':
        findtext = request.GET.get('findtext')
        all_catalog_items = Packages.detail(findtext)
    else:
        all_catalog_items = Packages.detail()
    catalog_list = Catalog.list()
    catalog_name = 'none'
    if PROD_CATALOG in catalog_list:
        catalog_name = PROD_CATALOG
    elif 'testing' in catalog_list:
        catalog_name = 'testing'
    return render_to_response('pkgs/index.html',
                              {'user': request.user,
                               'all_catalog_items': all_catalog_items,
                               'catalog_list': catalog_list,
                               'catalog_name': catalog_name,
                               'findtext': findtext,
                               'page': 'pkgs'})
Beispiel #2
0
def index(request, catalog_filter=None):
    can_view_pkgs = request.user.has_perm('pkgs.can_view_pkgs')
    can_view_manifests = request.user.has_perm('manifests.can_view_manifests')
    can_view_catalogs = request.user.has_perm('catalogs.can_view_catalogs')
    change_pkgs = request.user.has_perm('pkgs.change_pkgs')
    delete_pkgs = request.user.has_perm('pkgs.delete_pkgs')

    if not catalog_filter:
        catalog_filter = "all"
    
    git_enabled = None
    if GIT:
        git_enabled = GIT

    git_branching_enabled = None
    if GIT_BRANCHING:
        git_branching_enabled = GIT_BRANCHING
        # option to show the actual branch. It takes a toll on loading speed though
        # git_branch = Manifest.getGitBranch()

    if request.method == 'GET':
        findtext = request.GET.get('findtext')
    else:
        findtext = ""
    all_catalog_items = Packages.detail(catalog_filter, findtext)
    catalog_list = Catalog.list()
    catalog_name = 'none'
    if PROD_CATALOG in catalog_list:
        catalog_name = PROD_CATALOG
    elif 'testing' in catalog_list:
        catalog_name = 'testing'
    c = RequestContext(request, {'user': request.user,
                               'all_catalog_items': all_catalog_items,
                               'catalog_filter': catalog_filter,
                               'catalog_list': catalog_list,
                               'catalog_name': catalog_name,
                               'findtext': findtext,
                               'can_view_pkgs': can_view_pkgs,
                               'can_view_manifests': can_view_manifests,
                               'can_view_catalogs': can_view_catalogs,
                               'change_pkgs': change_pkgs,
                               'delete_pkgs': delete_pkgs,
                               'git_enabled': git_enabled,
                               'git_branching_enabled': git_branching_enabled,
                               'page': 'pkgs'})
    return render_to_response('pkgs/index.html', c)