當前位置: 首頁>>代碼示例>>Python>>正文


Python utils.LOGGER類代碼示例

本文整理匯總了Python中legal.common.utils.LOGGER的典型用法代碼示例。如果您正苦於以下問題:Python LOGGER類的具體用法?Python LOGGER怎麽用?Python LOGGER使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了LOGGER類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: transdel

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,代碼行數:27,代碼來源:views.py

示例2: szr_notice

def szr_notice(uid):

    text = ''
    res = Proceedings.objects.filter(uid=uid, notify=True).order_by('desc', 'id')
    if res:
        text = 'V těchto soudních řízeních, která sledujete, došlo ke změně:\n\n'
        for proc in res:
            desc = ' ({})'.format(proc.desc) if proc.desc else ''
            text += ' - {}, sp. zn. {}{}\n'.format(
                proc.court, composeref(proc.senate, proc.register, proc.number, proc.year), desc)
            if proc.court_id != SUPREME_ADMINISTRATIVE_COURT:
                court_type = 'ns' if proc.court_id == SUPREME_COURT else 'os'
                text += '   {}\n\n'.format(ROOT_URL + GET_PROC.format(
                    proc.court.id,
                    proc.court.reports.id if proc.court.reports
                    else proc.court.id,
                    proc.senate,
                    quote(proc.register.upper()),
                    proc.number,
                    proc.year,
                    court_type))
            elif proc.auxid:
                text += '   {}\n\n'.format(NSS_GET_PROC.format(proc.auxid))
            proc.notify = False
            proc.save()
        LOGGER.info('Non-empty notice prepared for user "{}" ({:d})'.format(User.objects.get(pk=uid).username, uid))
    return text
開發者ID:tompecina,項目名稱:legal,代碼行數:27,代碼來源:cron.py

示例3: dir_check

def dir_check(osoba, vec):

    for debtor in Debtor.objects.all():
        date_birth = osoba.datumNarozeni
        if date_birth:
            date_birth = date_birth.date()
        if ((not debtor.court or debtor.court == osoba.idOsobyPuvodce)
           and text_opt(debtor.name, osoba.nazevOsoby, debtor.name_opt)
           and text_opt(debtor.first_name, osoba.jmeno, debtor.first_name_opt)
           and (not debtor.genid or debtor.genid == osoba.ic)
           and (not debtor.taxid or icmp(debtor.taxid, osoba.dic))
           and (not debtor.birthid or debtor.birthid == osoba.rc)
           and (not debtor.date_birth or debtor.date_birth == date_birth)
           and (not debtor.year_birth_from or debtor.year_birth_from <= date_birth.year)
           and (not debtor.year_birth_to or debtor.year_birth_to >= date_birth.year)):
            if Discovered.objects.update_or_create(
                    uid_id=debtor.uid_id,
                    desc=debtor.desc,
                    vec=vec)[1]:
                if debtor.uid.email:
                    Debtor.objects.filter(id=debtor.id).update(notify=True)
                LOGGER.info(
                    'New debtor "{}" detected for user "{}" ({:d})'.format(
                        debtor.desc,
                        User.objects.get(pk=debtor.uid_id).username,
                        debtor.uid_id))
開發者ID:tompecina,項目名稱:legal,代碼行數:26,代碼來源:cron.py

示例4: stat

 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,代碼行數:32,代碼來源:apps.py

示例5: cron_update

def cron_update():

    cron_getws2()
    cron_gettr()
    cron_proctr()
    cron_deltr()
    cron_delerr()
    LOGGER.info('Batch processed')
開發者ID:tompecina,項目名稱:legal,代碼行數:8,代碼來源:cron.py

示例6: mainpage

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,代碼行數:58,代碼來源:views.py

示例7: cron_publishers

def cron_publishers():

    def proc_publisher(tag, typ, high=False, subsidiary_region=False, subsidiary_county=False, reports=None):
        pubid = int(tag['href'].rpartition('=')[2])
        name = (
            tag.text.replace('  ', ' ')
            .replace('KS ', 'Krajský soud ')
            .replace('MS ', 'Městský soud ')
            .replace('OS Praha ', 'Obvodní soud Praha ')
            .replace('OS ', 'Okresní soud ')
            .replace('KSZ ', 'Krajské státní zastupitelství ')
            .replace('MSZ ', 'Městské státní zastupitelství ')
            .replace('OSZ Praha ', 'Obvodní státní zastupitelství Praha ')
            .replace('OSZ ', 'Okresní státní zastupitelství ')
        )
        return Publisher.objects.update_or_create(
            name=name,
            defaults={
                'type': typ,
                'pubid': pubid,
                'high': high,
                'subsidiary_region': subsidiary_region,
                'subsidiary_county': subsidiary_county,
                'reports': reports,
                'updated': datetime.now() - UPDATE_INTERVAL})[0]


    def proc_publishers(soup, typ, high=False):
        if high:
            for tag in soup.find_all('a'):
                proc_publisher(tag, typ, high=True)
        else:
            rep = proc_publisher(soup.select('dt a')[0], typ)
            for tag in soup.find_all('dd'):
                cls = tag.get('class', [])
                subsidiary_region = 'pobockakraj' in cls
                subsidiary_county = 'pobockaokres' in cls
                proc_publisher(
                    tag.find('a'),
                    typ,
                    subsidiary_region=subsidiary_region,
                    subsidiary_county=subsidiary_county,
                    reports=rep)

    for typ in TYPES:
        try:
            res = get(PUBLISHERS_URL.format(typ))
            soup = BeautifulSoup(res.text, 'html.parser')
            high = soup.find('div', 'bezlokality')
            lower = soup.find('div', 'slokalitou')
            proc_publishers(high, typ, high=True)
            for reg in lower.find_all('dl'):
                proc_publishers(reg, typ, high=False)
        except:
            pass

    LOGGER.info('Publishers imported')
開發者ID:tompecina,項目名稱:legal,代碼行數:57,代碼來源:cron.py

示例8: userinfo

 def userinfo(user):
     from legal.common.utils import LOGGER
     from legal.dir.models import Debtor
     LOGGER.debug('Partial user information generated')
     return (
         (
             'Počet sledovaných dlužníků',
             Debtor.objects.filter(uid=user).count()),
     )
開發者ID:tompecina,項目名稱:legal,代碼行數:9,代碼來源:apps.py

示例9: courts

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,代碼行數:9,代碼來源:views.py

示例10: cron_gettr

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,代碼行數:56,代碼來源:cron.py

示例11: cron_fixindex

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,代碼行數:11,代碼來源:cron.py

示例12: cron_remove_orphans

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,代碼行數:12,代碼來源:cron.py

示例13: cron_refresh_links

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,代碼行數:14,代碼來源:cron.py

示例14: sur_notice

def sur_notice(uid):

    text = ''
    res = Found.objects.filter(uid=uid).order_by('name', 'id').distinct()
    if res:
        text = 'Byli nově zaznamenáni tito účastníci řízení, které sledujete:\n\n'
        for item in res:
            text += ' - {0.name}, {0.court}, sp. zn. {1}\n'.format(
                item, composeref(item.senate, item.register, item.number, item.year))
            text += '   {}\n\n'.format(item.url)
        Found.objects.filter(uid=uid).delete()
        LOGGER.info('Non-empty notice prepared for user "{}" ({:d})'.format(User.objects.get(pk=uid).username, uid))
    Party.objects.filter(uid=uid).update(notify=False)
    return text
開發者ID:tompecina,項目名稱:legal,代碼行數:14,代碼來源:cron.py

示例15: partyexport

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,代碼行數:14,代碼來源:views.py


注:本文中的legal.common.utils.LOGGER類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。