当前位置: 首页>>代码示例>>Python>>正文


Python LOGGER.debug方法代码示例

本文整理汇总了Python中legal.common.utils.LOGGER.debug方法的典型用法代码示例。如果您正苦于以下问题:Python LOGGER.debug方法的具体用法?Python LOGGER.debug怎么用?Python LOGGER.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在legal.common.utils.LOGGER的用法示例。


在下文中一共展示了LOGGER.debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: stat

# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import debug [as 别名]
 def stat():
     from django.contrib.auth.models import User
     from legal.common.utils import LOGGER
     from legal.common.models import PwResetLink, Preset, Cache, Asset
     now = datetime.now()
     LOGGER.debug('Partial statistics generated')
     return (
         (
             'Počet uživatelů',
             User.objects.count()),
         (
             'Počet nových uživatelů za posledních 24 hodin',
             User.objects.filter(date_joined__gte=(now - timedelta(hours=24))).count()),
         (
             'Počet nových uživatelů za poslední týden',
             User.objects.filter(date_joined__gte=(now - timedelta(weeks=1))).count()),
         (
             'Počet nových uživatelů za poslední měsíc',
             User.objects.filter(date_joined__gte=(now - timedelta(days=30))).count()),
         (
             'Počet dočasných linků pro obnovení hesla',
             PwResetLink.objects.count()),
         (
             'Počet záznamů v tabulce Preset',
             Preset.objects.count()),
         (
             'Počet položek v tabulce Cache',
             Cache.objects.count()),
         (
             'Počet položek v tabulce Asset',
             Asset.objects.count()),
     )
开发者ID:tompecina,项目名称:legal,代码行数:34,代码来源:apps.py

示例2: transdel

# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import debug [as 别名]
def transdel(request, idx=0):

    LOGGER.debug(
        'Transaction delete page accessed using method {}, id={}'.format(request.method, idx),
        request,
        request.POST)
    idx = int(idx) - 1
    debt = getdebt(request)
    if not debt:  # pragma: no cover
        return error(request)
    if idx >= len(debt.transactions):
        raise Http404
    if request.method == 'GET':
        return render(
            request,
            'hjp_transdel.xhtml',
            {'app': APP,
             'page_title': 'Smazání transakce',
             'date': debt.transactions[idx].date})
    else:
        button = getbutton(request)
        if button == 'yes':
            del debt.transactions[idx]
            if not setdebt(request, debt):  # pragma: no cover
                return error(request)
            return redirect('hjp:transdeleted')
        return redirect('hjp:mainpage')
开发者ID:tompecina,项目名称:legal,代码行数:29,代码来源:views.py

示例3: mainpage

# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import debug [as 别名]
def mainpage(request):

    LOGGER.debug('Main page accessed using method {}'.format(request.method), request, request.POST)

    messages = []

    if request.method == 'GET':
        form = MainForm()

    else:
        form = MainForm(request.POST)
        if form.is_valid():
            cld = form.cleaned_data
            beg_date = cld['beg_date']
            years = (cld['years'] if cld['years'] else 0)
            months = (cld['months'] if cld['months'] else 0)
            days = (cld['days'] if cld['days'] else 0)

            messages.append(
                ('Trest skončí: {}'.format(calc(
                    beg_date,
                    years, months,
                    days)),
                 'res'))
            messages.append(
                ('Třetina trestu: {}'.format(calc(
                    beg_date,
                    years // 3,
                    ((years % 3) * 4) + (months // 3),
                    ((months % 3) * 10) + (days // 3))),
                 'normal'))
            messages.append(
                ('Polovina trestu: {}'.format(calc(
                    beg_date,
                    years // 2,
                    ((years % 2) * 6) + (months // 2),
                    ((months % 2) * 15) + (days // 2))),
                 'normal'))
            messages.append(
                ('Dvě třetiny trestu: {}'.format(calc(
                    beg_date,
                    (years * 2) // 3,
                    (((years * 2) % 3) * 4) + ((months * 2) // 3),
                    (((months * 2) % 3) * 10) + ((days * 2) // 3))),
                 None))


        else:
            LOGGER.debug('Invalid form', request)
            messages = [(INERR_SHORT, None)]

    return render(
        request,
        'dvt_mainpage.xhtml',
        {'app': APP,
         'form': form,
         'messages': messages,
         'page_title': 'Doba výkonu trestu'})
开发者ID:tompecina,项目名称:legal,代码行数:60,代码来源:views.py

示例4: userinfo

# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import debug [as 别名]
 def userinfo(user):
     from legal.common.utils import LOGGER
     from legal.sur.models import Party
     LOGGER.debug('Partial user information generated')
     return (
         (
             'Počet sledovaných účastníků',
             Party.objects.filter(uid=user).count()),
     )
开发者ID:tompecina,项目名称:legal,代码行数:11,代码来源:apps.py

示例5: courts

# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import debug [as 别名]
def courts(request):

    LOGGER.debug('List of courts accessed', request)
    return render(
        request,
        'szr_courts.xhtml',
        {'app': APP,
         'page_title': 'Přehled soudů',
         'rows': Court.objects.order_by('name').values('id', 'name')})
开发者ID:tompecina,项目名称:legal,代码行数:11,代码来源:views.py

示例6: cron_gettr

# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import debug [as 别名]
def cron_gettr():

    idx = Counter.objects.get(id='DL').number
    while True:
        soup = BeautifulSoup('', 'lxml')
        soup.is_xml = True

        envelope = soup.handle_starttag(
            'Envelope', None,
            'soapenv', {
                'xmlns:soapenv': 'http://schemas.xmlsoap.org/soap/envelope/',
                'xmlns:typ': 'http://isirpublicws.cca.cz/types/'})
        header = soup.new_tag('Header', None, 'soapenv')
        envelope.append(header)
        body = soup.new_tag('Body', None, 'soapenv')
        envelope.append(body)
        req = soup.new_tag('getIsirWsPublicIdDataRequest', None, 'typ')
        body.append(req)
        idPodnetu = soup.new_tag('idPodnetu', None, None)
        idPodnetu.append(str(idx))
        req.append(idPodnetu)
        url = 'https://isir.justice.cz:8443/isir_public_ws/IsirWsPublicService'

        headers = {
            'content-type': 'text/xml; charset=utf-8',
            'SOAPAction': '"http://isirpublicws.cca.cz/types/"',
        }

        res = post(url, soup.renderContents(), headers=headers)

        xml = res.content.decode('utf-8')

        soup = BeautifulSoup(xml, 'lxml')
        soup.is_xml = True

        if not (soup.stav and soup.stav.string == 'OK' and soup.find('data')):
            break

        lst = []
        for t_data in soup.find_all('data'):
            idx = int(t_data.id.string)
            lst.append(Transaction(
                id=idx,
                datumZalozeniUdalosti=convdt(t_data.datumzalozeniudalosti),
                datumZverejneniUdalosti=convdt(t_data.datumzverejneniudalosti),
                dokumentUrl=(t_data.dokumenturl.string.strip() if t_data.dokumenturl else None),
                spisovaZnacka=t_data.spisovaznacka.string.strip(),
                typUdalosti=t_data.typudalosti.string.strip(),
                popisUdalosti=t_data.popisudalosti.string.strip(),
                oddil=(t_data.oddil.string.strip() if t_data.oddil else None),
                cisloVOddilu=(int(t_data.cislovoddilu.string) if t_data.cislovoddilu else None),
                poznamkaText=(t_data.poznamka.string.strip() if t_data.poznamka else None),
                error=False))

        Transaction.objects.bulk_create(lst)
        LOGGER.debug('Read {:d} transaction(s)'.format(len(lst)))
开发者ID:tompecina,项目名称:legal,代码行数:58,代码来源:cron.py

示例7: cron_fixindex

# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import debug [as 别名]
def cron_fixindex():

    num = 0
    for doc in Document.objects.all():
        if not DocumentIndex.objects.using('sphinx').filter(id=doc.id).exists():
            num += 1
            update_index(doc)
    if num:
        LOGGER.info('Index fixed, {:d} record(s) added'.format(num))
    else:
        LOGGER.debug('Index fixed, no records added')
开发者ID:tompecina,项目名称:legal,代码行数:13,代码来源:cron.py

示例8: cron_remove_orphans

# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import debug [as 别名]
def cron_remove_orphans():

    num = 0
    for doc in Document.objects.all():
        if not File.objects.filter(document=doc).exists():
            num += 1
            DocumentIndex.objects.using('sphinx').filter(id=doc.id).delete()
            doc.delete()
    if num:
        LOGGER.info('Removed {:d} orphan(s)'.format(num))
    else:
        LOGGER.debug('No orphans removed')
开发者ID:tompecina,项目名称:legal,代码行数:14,代码来源:cron.py

示例9: procform

# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import debug [as 别名]
def procform(request, idx=0):

    LOGGER.debug('Proceedings form accessed using method {}, id={}'.format(request.method, idx), request, request.POST)
    err_message = ''
    uid = request.user.id
    uname = request.user.username
    page_title = 'Úprava řízení' if idx else 'Nové řízení'
    button = getbutton(request)
    if request.method == 'GET':
        form = ProcForm(initial=model_to_dict(get_object_or_404(Proceedings, pk=idx, uid=uid))) if idx else ProcForm()
    elif button == 'back':
        return redirect('szr:mainpage')
    else:
        form = ProcForm(request.POST)
        if form.is_valid():
            cld = form.cleaned_data
            if not cld['senate']:
                cld['senate'] = 0
            if idx:
                proc = get_object_or_404(Proceedings, pk=idx, uid=uid)
                cld['pk'] = idx
                cld['timestamp_add'] = proc.timestamp_add
            cld['court_id'] = cld['court']
            del cld['court']
            onlydesc = (
                idx and proc.court.id == cld['court_id'] and proc.senate == cld['senate']
                and proc.register == cld['register'] and proc.number == cld['number'] and proc.year == cld['year'])
            if onlydesc:
                cld['changed'] = proc.changed
                cld['updated'] = proc.updated
                cld['hash'] = proc.hash
                cld['auxid'] = proc.auxid
                cld['notify'] = proc.notify
            proc = Proceedings(uid_id=uid, **cld)
            if not onlydesc:
                updateproc(proc)
            proc.save()
            LOGGER.info(
                'User "{}" ({:d}) {} proceedings "{}" ({})'
                .format(uname, uid, 'updated' if idx else 'added', proc.desc, p2s(proc)),
                request)
            return redirect('szr:mainpage')
        else:  # pragma: no cover
            LOGGER.debug('Invalid form', request)
            err_message = INERR
    return render(
        request,
        'szr_procform.xhtml',
        {'app': APP,
         'form': form,
         'page_title': page_title,
         'err_message': err_message})
开发者ID:tompecina,项目名称:legal,代码行数:54,代码来源:views.py

示例10: cron_refresh_links

# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import debug [as 别名]
def cron_refresh_links():

    batch = Vec.objects.filter(datumVyskrtnuti__isnull=True, link__isnull=False, refreshed__isnull=True).order_by('id')
    if not batch:
        batch = Vec.objects.filter(datumVyskrtnuti__isnull=True, link__isnull=False).order_by('refreshed')
    batch = batch[:REFRESH_BATCH]

    num = 0
    matrix = [0] * 5
    for vec in batch:
        matrix[refresh_link(vec)] += 1
        num += 1

    LOGGER.debug('Refreshed {:d} links(s), results: {}'.format(num, matrix))
开发者ID:tompecina,项目名称:legal,代码行数:16,代码来源:cron.py

示例11: partyexport

# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import debug [as 别名]
def partyexport(request):

    LOGGER.debug('Party export page accessed', request)
    uid = request.user.id
    uname = request.user.username
    res = Party.objects.filter(uid=uid).order_by('party', 'party_opt', 'id').distinct()
    response = HttpResponse(content_type='text/csv; charset=utf-8')
    response['Content-Disposition'] = 'attachment; filename=sur.csv'
    writer = csvwriter(response)
    for item in res:
        dat = (item.party + TEXT_OPTS_CA[item.party_opt],)
        writer.writerow(dat)
    LOGGER.info('User "{}" ({:d}) exported parties'.format(uname, uid), request)
    return response
开发者ID:tompecina,项目名称:legal,代码行数:16,代码来源:views.py

示例12: cron_notify

# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import debug [as 别名]
def cron_notify():

    for user in User.objects.all():
        uid = user.id
        text = szr_notice(uid) + sur_notice(uid) + sir_notice(uid) + dir_notice(uid) + uds_notice(uid)
        if text and user.email:
            text += 'Server {} ({})\n'.format(LOCAL_SUBDOMAIN, LOCAL_URL)
            send_mail(
                'Zprava ze serveru {}'.format(LOCAL_SUBDOMAIN),
                text,
                [user.email])
            LOGGER.debug(
                'Email sent to user "{}" ({:d})'
                .format(User.objects.get(pk=uid).username, uid))
    LOGGER.info('Emails sent')
开发者ID:tompecina,项目名称:legal,代码行数:17,代码来源:cron.py

示例13: partydelall

# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import debug [as 别名]
def partydelall(request):

    LOGGER.debug('Delete all parties page accessed using method {}'.format(request.method), request)
    uid = request.user.id
    uname = request.user.username
    if request.method == 'GET':
        return render(
            request,
            'sur_partydelall.xhtml',
            {'app': APP,
             'page_title': 'Smazání všech účastníků'})
    else:
        if getbutton(request) == 'yes' and 'conf' in request.POST and request.POST['conf'] == 'Ano':
            Party.objects.filter(uid=uid).delete()
            LOGGER.info('User "{}" ({:d}) deleted all parties'.format(uname, uid), request)
        return redirect('sur:mainpage')
开发者ID:tompecina,项目名称:legal,代码行数:18,代码来源:views.py

示例14: htmllist

# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import debug [as 别名]
def htmllist(request):

    LOGGER.debug('HTML list accessed', request, request.GET)
    reqd = request.GET.copy()
    try:
        par = g2p(reqd)
        start = int(reqd['start']) if 'start' in reqd else 0
        assert start >= 0
        res = Vec.objects.filter(**par).order_by('firstAction', 'rocnik', 'bc', 'idOsobyPuvodce').distinct()
    except:
        raise Http404
    total = res.count()
    if total and start >= total:
        start = total - 1
    creditors = 'creditors' in reqd
    batch = 10 if creditors else 20
    rows = res[start:start + batch]
    for row in rows:
        row.court = L2N[row.idOsobyPuvodce]
        row.court_short = L2S[row.idOsobyPuvodce]
        row.court_reg = L2R[row.idOsobyPuvodce]
        row.state = S2D[row.druhStavRizeni.desc] if row.druhStavRizeni else '(není známo)'
        row.debtors = []
        for osoba in getosoby(row, 'debtor'):
            row.debtors.append({
                'text': o2s(osoba, detailed=True),
                'id': osoba.id})
        row.trustees = []
        for osoba in getosoby(row, 'trustee'):
            row.trustees.append({
                'text': o2s(osoba),
                'id': osoba.id})
        if creditors:
            row.creditors = []
            for osoba in getosoby(row, 'motioner', 'creditor'):
                row.creditors.append({'text': o2s(osoba), 'id': osoba.id})
    return render(
        request,
        'pir_list.xhtml',
        {'app': APP,
         'page_title': 'Výsledky vyhledávání',
         'rows': rows,
         'creditors': creditors,
         'pager': Pager(start, total, reverse('pir:htmllist'), reqd, batch),
         'total': total,
         'NULL_REGISTERS': NULL_REGISTERS,
         'noindex': True})
开发者ID:tompecina,项目名称:legal,代码行数:49,代码来源:views.py

示例15: partyform

# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import debug [as 别名]
def partyform(request, idx=0):

    LOGGER.debug('Party form accessed using method {}, id={}'.format(request.method, idx), request, request.POST)

    err_message = ''
    uid = request.user.id
    uname = request.user.username
    page_title = 'Úprava účastníka' if idx else 'Nový účastník'

    button = getbutton(request)
    if request.method == 'GET':
        if idx:
            dct = model_to_dict(get_object_or_404(Party, pk=idx, uid=uid))
            dct['party_opt'] = TEXT_OPTS_KEYS[dct['party_opt']]
            form = PartyForm(initial=dct)
        else:
            form = PartyForm()
    elif button == 'back':
        return redirect('sur:mainpage')
    else:
        form = PartyForm(request.POST)
        if form.is_valid():
            cld = form.cleaned_data
            if idx:
                res = get_object_or_404(Party, pk=idx, uid=uid)
                cld['pk'] = idx
                cld['notify'] = res.notify
                cld['timestamp_add'] = res.timestamp_add
            res = Party(uid_id=uid, **cld)
            res.party_opt = TEXT_OPTS_KEYS.index(cld['party_opt'])
            res.save()
            LOGGER.info(
                'User "{}" ({:d}) {} party {}'.format(uname, uid, 'updated' if idx else 'added', res.party),
                request)
            return redirect('sur:mainpage')
        else:
            LOGGER.debug('Invalid form', request)
            err_message = INERR
    return render(
        request,
        'sur_partyform.xhtml',
        {'app': APP,
         'form': form,
         'min_chars': grammar(MIN_LENGTH, GR_CHAR),
         'page_title': page_title,
         'err_message': err_message})
开发者ID:tompecina,项目名称:legal,代码行数:48,代码来源:views.py


注:本文中的legal.common.utils.LOGGER.debug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。