Exemplo n.º 1
0
    "CC BY": {'BY': True, 'NC': False, 'ND': False, 'SA': False, 'form_label': 'CC BY'},
    "CC BY-SA": {'BY': True, 'NC': False, 'ND': False, 'SA': True, 'form_label': 'CC BY-SA'},
    "CC BY-NC": {'BY': True, 'NC': True, 'ND': False, 'SA': False, 'form_label': 'CC BY-NC'},
    "CC BY-ND": {'BY': True, 'NC': False, 'ND': True, 'SA': False, 'form_label': 'CC BY-ND'},
    "CC BY-NC-ND": {'BY': True, 'NC': True, 'ND': True, 'SA': False, 'form_label': 'CC BY-NC-ND'},
    "CC BY-NC-SA": {'BY': True, 'NC': True, 'ND': False, 'SA': True, 'form_label': 'CC BY-NC-SA'},
}

for lic_type, lic_info in licenses.iteritems():
    lic_info['type'] = lic_type  # do not change this - the top-level keys in the licenses dict should always be == to the "type" of each license object
    lic_info['title'] = lic_type

license_dict = OrderedDict(sorted(licenses.items(), key=lambda x: x[1]['type']))

main_license_options = []
for lic_type, lic_info in license_dict.iteritems():
    main_license_options.append((lic_type, lic_info['form_label']))

def language_for(rep):
    r = rep.lower().strip()
    for l in languages_iso639_2:
        for variant in l:
            if variant.lower() == r:
                return l
    return None

def name_for_lang(rep):
    lang = language_for(rep)
    if lang is not None:
        return lang[3]
    else:
Exemplo n.º 2
0
languages_dict = OrderedDict(sorted(languages.items(), key=lambda x: x[1]['name']))
languages = languages_dict.items()
language_options = []
language_options_two_char_code_index = []
for code, language_info in languages:
    language_options.append((code, language_info['name']))
    language_options_two_char_code_index.append(code)

# license rights by license type
licenses = {
    # the titles and types are made to match the current values of
    # journals in the DOAJ for now - they can be cleaned up but it might
    # not be such a small job
    # Also DOAJ currently assumes type and title are the same.
    "CC BY": {'BY': True, 'NC': False, 'ND': False, 'SA': False, 'form_label': 'CC BY'},
    "CC BY-SA": {'BY': True, 'NC': False, 'ND': False, 'SA': True, 'form_label': 'CC BY-SA'},
    "CC BY-NC": {'BY': True, 'NC': True, 'ND': False, 'SA': False, 'form_label': 'CC BY-NC'},
    "CC BY-ND": {'BY': True, 'NC': False, 'ND': True, 'SA': False, 'form_label': 'CC BY-ND'},
    "CC BY-NC-ND": {'BY': True, 'NC': True, 'ND': True, 'SA': False, 'form_label': 'CC BY-NC-ND'},
}

for lic_type, lic_info in licenses.iteritems():
    lic_info['type'] = lic_type  # do not change this - the top-level keys in the licenses dict should always be == to the "type" of each license object
    lic_info['title'] = lic_type

license_dict = OrderedDict(sorted(licenses.items(), key=lambda x: x[1]['type']))

main_license_options = []
for lic_type, lic_info in license_dict.iteritems():
    main_license_options.append((lic_type, lic_info['form_label']))