Beispiel #1
0
if 'unstable' in distro_names:
    distro_names.remove('unstable')

def generate_old_stack_header(macro, stack_name, opt_distro=None):
    try:
        data = load_stack_manifest(stack_name, opt_distro)
    except UtilException, e:
        name = "name: %s, distro: %s" % (stack_name, opt_distro)
        return CONTRIBUTE_TMPL%locals()
  
    packages = data.get('packages', [])
    is_unary = [stack_name] == packages
    
    desc = get_description(macro, data, 'stack')
    nav = get_nav(macro, stack_name, packages, distro=opt_distro)
    links = get_stack_links(macro, stack_name, data, packages, is_unary, opt_distro)

    if is_unary:
        try:
            package_data = load_package_manifest(stack_name, opt_distro)
            links += get_package_links(macro, stack_name, package_data, opt_distro, None)
        except:
            pass

    return macro.formatter.rawHTML(nav) + '<br><br>' + macro.formatter.rawHTML(links) + desc

def macro_StackHeader(macro, arg1, arg2=None):
    stack_name = get_unicode(macro.request, arg1)
    opt_distro = get_unicode(macro.request, arg2)
    if ' ' in stack_name:
        #something changed in the API such that the above arg1, arg2 passing no longer works
Beispiel #2
0
        #something changed in the API such that the above arg1, arg2 passing no longer works
        splits = stack_name.split(' ')
        if len(splits) > 2:
            return "ERROR in StackHeader. Usage: [[StackHeader(pkg_name opt_lang)]]"
        stack_name, lang = splits
    if not stack_name:
        return "ERROR in StackHeader. Usage: [[StackHeader(pkg_name opt_lang)]]"

    try:
        data = load_stack_manifest(stack_name, lang)
    except UtilException, e:
        name = stack_name
        return CONTRIBUTE_TMPL%locals()
  
    packages = data.get('packages', [])
    is_unary = [stack_name] == packages
    
    desc = get_description(macro, data, 'stack')
    nav = get_nav(macro, stack_name, packages)
    links = get_stack_links(macro, stack_name, data, packages, is_unary)

    if is_unary:
        try:
            package_data = load_package_manifest(stack_name, lang)
            links += get_package_links(macro, stack_name, package_data)
        except:
            pass

    return macro.formatter.rawHTML(nav) + macro.formatter.rawHTML(links) + desc