Esempio n. 1
0
def individual_license(license):
    if license == 'None':
        license = None
    publishers = [ publisher_name for publisher_name, publisher in ckan.items() for _, package in publisher.items() if package.get('license_id') == license ]
    publisher_counts = [ (publisher, publishers.count(publisher)) for publisher in set(publishers) ]
    return render_template('license.html',
        url=lambda x: '../'+x,
        license=license,
        license_names=license_names,
        publisher_counts=publisher_counts,
        licenses=True)
Esempio n. 2
0
def individual_license(license):
    if license == 'None':
        license = None
    publishers = [ publisher_name for publisher_name, publisher in ckan.items() for _, package in publisher.items() if package.get('license_id') == license ]
    publisher_counts = [ (publisher, publishers.count(publisher)) for publisher in set(publishers) ]
    return render_template('license.html',
        url=lambda x: '../'+x,
        license=license,
        license_names=license_names,
        publisher_counts=publisher_counts,
        page='licenses',
        licenses=True)
Esempio n. 3
0
def main():
    licenses_and_publisher = set([ (package.get('license_id'), publisher_name) for publisher_name, publisher in ckan.items() for package_name, package in publisher.items() ])
    licenses_per_publisher = [ license for license, publisher in licenses_and_publisher ]

    return render_template('licenses.html',
        license_names=license_names,
        license_count = dict((x,licenses.count(x)) for x in set(licenses)),
        publisher_license_count = dict((x,licenses_per_publisher.count(x)) for x in set(licenses_per_publisher)),
        sorted=sorted,
        page='licenses',
        licenses=True)
Esempio n. 4
0
'sleepycat': 'OSI Approved::Sleepycat License',
'sun-issl': 'OSI Approved::Sun Industry Standards Source License (SISSL)',
'sunpublic': 'OSI Approved::Sun Public License',
'sybase': 'OSI Approved::Sybase Open Watcom Public License 1.0',
'UoI-NCSA': 'OSI Approved::University of Illinois/NCSA Open Source License',
'vovidapl': 'OSI Approved::Vovida Software License v. 1.0',
'W3C': 'OSI Approved::W3C License',
'wxwindows': 'OSI Approved::wxWindows Library License',
'xnet': 'OSI Approved::X.Net License',
'zpl': 'OSI Approved::Zope Public License',
'zlib-license': 'OSI Approved::zlib/libpng license'}

from flask import render_template
from data import ckan

licenses = [ package.get('license_id') for _, publisher in ckan.items() for _, package in publisher.items() ]

def licenses_for_publisher(publisher_name):
    # Check publisher is in the compiled list of CKAN data
    # Arises from https://github.com/IATI/IATI-Dashboard/issues/408
    if publisher_name not in ckan.keys():
        return set()

    # Return unique licenses used
    return set([ package.get('license_id') for package in ckan[publisher_name].values() ])

def main():
    licenses_and_publisher = set([ (package.get('license_id'), publisher_name) for publisher_name, publisher in ckan.items() for package_name, package in publisher.items() ])
    licenses_per_publisher = [ license for license, publisher in licenses_and_publisher ]

    return render_template('licenses.html',