コード例 #1
0
def narrative_view(request, narrative_id):
    """
    :param request: the request
    :param narrative_id: the narrative id, a url to be matched
    :return: a serialized JSON blob of the narrative dict
    """
    filename = os.path.join(settings.CONTENT_DATA_PATH, "narratives")
    narratives = open_json_or_yml(filename)
    the_narrative = {}
    for key, narr in narratives.iteritems():
        exp = re.compile(key)
        if exp.search(narrative_id):
            the_narrative[key] = narr
            break
    return JsonResponse(the_narrative)
コード例 #2
0
ファイル: version.py プロジェクト: di445/ka-lite
def VERSION_INFO():
    """
    Load a dictionary of changes between each version. The key of the
    dictionary is the VERSION (i.e. X.X.X), with the value being another dictionary with
    the following keys:

    release_date
    git_commit
    new_features
    bugs_fixed

    """

    # we import settings lazily, since the settings modules depends on
    # this file. Importing it on top will lead to circular imports.
    from django.conf import settings

    return open_json_or_yml(os.path.join(settings.CONTENT_DATA_PATH, "version.yml"))
コード例 #3
0
ファイル: version.py プロジェクト: theaverageguy/ka-lite
def VERSION_INFO():
    """
    Load a dictionary of changes between each version. The key of the
    dictionary is the VERSION (i.e. X.X.X), with the value being another dictionary with
    the following keys:

    release_date
    git_commit
    new_features
    bugs_fixed

    """

    # we import settings lazily, since the settings modules depends on
    # this file. Importing it on top will lead to circular imports.
    from django.conf import settings

    return open_json_or_yml(
        os.path.join(settings.CONTENT_DATA_PATH, "version.yml"))
コード例 #4
0
def narrative_view(request, narrative_id):
    """
    :param request: the request
    :param narrative_id: the narrative id, a url to be matched
    :return: a serialized JSON blob of the narrative dict
    """
    filename = os.path.join(settings.CONTENT_DATA_PATH, "narratives")
    narratives = open_json_or_yml(filename)
    the_narrative = {}
    for key, narr in narratives.iteritems():
        exp = re.compile(key)
        if exp.search(narrative_id):
            the_narrative[key] = narr
            break

    if not the_narrative:
        return JsonResponseMessageWarning(_("No inline help is available for this page."), status=404)

    return JsonResponse(the_narrative)