• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

iplweb / bpp / 0950478e-207f-4389-967f-fb3a6c1090d4

01 Apr 2025 12:57PM UTC coverage: 43.279% (-3.3%) from 46.628%
0950478e-207f-4389-967f-fb3a6c1090d4

push

circleci

mpasternak
Merge branch 'release/v202504.1175'

1 of 19 new or added lines in 5 files covered. (5.26%)

1780 existing lines in 123 files now uncovered.

15876 of 36683 relevant lines covered (43.28%)

0.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

51.92
src/bpp/views/__init__.py
1
import bleach
2✔
2
from django import shortcuts
2✔
3

4
try:
2✔
5
    from django.core.urlresolvers import reverse
2✔
6
except ImportError:
2✔
7
    from django.urls import reverse
2✔
8

9
from django.http import JsonResponse
2✔
10
from django.http.response import HttpResponse
2✔
11
from django.views.decorators.csrf import csrf_exempt
2✔
12
from django.views.defaults import page_not_found, permission_denied, server_error
2✔
13
from django_sendfile import sendfile
2✔
14

15
from bpp.models import Uczelnia
2✔
16

17

18
def root(request):
2✔
19
    """Zachowanie domyślne: przekieruj nas na pierwszą dostępną w bazie danych
20
    uczelnię, lub wyświetl komunikat jeżeli nie ma żadnych uczelni wpisanych do
21
    bazy danych."""
22
    # TODO: jeżeli będzie więcej, niż jeden obiekt Uczelnia...?
23
    uczelnia = Uczelnia.objects.only("slug").first()
×
24

25
    if uczelnia is None:
×
26
        return shortcuts.render(request, "browse/brak_uczelni.html")
×
27

28
    return shortcuts.redirect(
×
29
        reverse("bpp:browse_uczelnia", args=(uczelnia.slug,)), permanent=True
30
    )
31

32

33
def favicon(request):
2✔
UNCOV
34
    try:
1✔
UNCOV
35
        fn = Uczelnia.objects.get(pk=1).favicon_ico
1✔
UNCOV
36
    except Uczelnia.DoesNotExist:
1✔
UNCOV
37
        return HttpResponse("create Uczelnia object first")
1✔
38

39
    try:
×
40
        return sendfile(request, fn.path)
×
41
    except ValueError:
×
42
        return HttpResponse("icon image is not set")
×
43
        # raise Http404
44

45

46
@csrf_exempt
2✔
47
def update_multiseek_title(request):
2✔
48
    v = request.POST.get("value")
×
49
    if not v or not len(v):
×
50
        v = ""
×
51
    from django.conf import settings
×
52

53
    v = bleach.clean(
×
54
        v.replace("\r\n", "\n").replace("\n", "<br/>"),
55
        tags=list(getattr(settings, "ALLOWED_TAGS", [])) + ["hr", "p", "br"],
56
    )
57
    request.session["MULTISEEK_TITLE"] = v
×
58
    return JsonResponse(v, safe=False)
×
59

60

61
# !/usr/bin/env python
62
# vim:ts=4:sw=4:et:ft=python
63
#
64
# Caching decorator for Django /jsi18n/
65
# http://wtanaka.com/django/jsi18ncache
66
#
67
# Copyright (C) 2009 Wesley Tanaka <http://wtanaka.com>
68
#
69
# This program is free software: you can redistribute it and/or modify
70
# it under the terms of the GNU General Public License as published by
71
# the Free Software Foundation, either version 3 of the License, or
72
# (at your option) any later version.
73
#
74
# This program is distributed in the hope that it will be useful,
75
# but WITHOUT ANY WARRANTY; without even the implied warranty of
76
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
77
# GNU General Public License for more details.
78
#
79
# You should have received a copy of the GNU General Public License
80
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
81

82
import datetime
2✔
83

84
TEN_YEARS = datetime.timedelta(days=3650)
2✔
85

86

87
def javascript_catalog(request, domain="djangojs", packages=None):
2✔
88
    import django.views.i18n
×
89

90
    response = django.views.i18n.javascript_catalog(
×
91
        request, domain=domain, packages=packages
92
    )
93
    from django.utils.translation import check_for_language
×
94

95
    if (
×
96
        request.GET
97
        and "language" in request.GET
98
        and check_for_language(request.GET["language"])
99
    ):
100
        expires = datetime.datetime.now() + TEN_YEARS
×
101
        response["Expires"] = expires.strftime("%a, %d %b %Y %H:%M:%S GMT")
×
102
        response["Cache-Control"] = "public"
×
103
    return response
×
104

105

106
def handler404(request, exception):
2✔
107
    return page_not_found(request, exception, "404.html")
1✔
108

109

110
def handler403(request, exception=None):
2✔
111
    return permission_denied(request, "403.html")
×
112

113

114
def handler500(request):
2✔
115
    return server_error(request, template_name="50x.html")
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc