本文整理汇总了Python中legal.common.utils.LOGGER.info方法的典型用法代码示例。如果您正苦于以下问题:Python LOGGER.info方法的具体用法?Python LOGGER.info怎么用?Python LOGGER.info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类legal.common.utils.LOGGER
的用法示例。
在下文中一共展示了LOGGER.info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: szr_notice
# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import info [as 别名]
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
示例2: cron_courts
# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import info [as 别名]
def cron_courts():
try:
res = get(ROOT_URL + LIST_COURTS)
soup = BeautifulSoup(res.text, 'html.parser')
Court.objects.get_or_create(id=SUPREME_COURT, name='Nejvyšší soud')
Court.objects.get_or_create(id=SUPREME_ADMINISTRATIVE_COURT, name='Nejvyšší správní soud')
upper = soup.find(id='kraj').find_all('option')[1:]
lower = soup.find(id='soudy').find_all('option')[1:]
for court in upper + lower:
Court.objects.get_or_create(id=court['value'], name=court.string.encode('utf-8'))
except: # pragma: no cover
LOGGER.warning('Error importing courts')
Court.objects.all().update(reports=None)
for court in Court.objects.all():
if isreg(court):
try:
sleep(1)
res = get(ROOT_URL + LIST_REPORTS.format(court.pk))
soup = BeautifulSoup(res.text, 'xml')
for item in soup.find_all('okresniSoud'):
Court.objects.filter(pk=item.id.string).update(reports=court)
except: # pragma: no cover
LOGGER.warning('Error setting hierarchy for {}'.format(court.id))
LOGGER.info('Courts imported')
示例3: dir_check
# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import info [as 别名]
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))
示例4: cron_update
# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import info [as 别名]
def cron_update():
cron_getws2()
cron_gettr()
cron_proctr()
cron_deltr()
cron_delerr()
LOGGER.info('Batch processed')
示例5: cron_publishers
# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import info [as 别名]
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')
示例6: cron_fixindex
# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import info [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')
示例7: cron_remove_orphans
# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import info [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')
示例8: procform
# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import info [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})
示例9: partyexport
# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import info [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
示例10: sur_notice
# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import info [as 别名]
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
示例11: cron_schedule
# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import info [as 别名]
def cron_schedule(*args):
dates = []
for arg in args:
if len(arg) > 2:
string = arg.split('.')
dates.append(date(*map(int, string[2::-1])))
else:
dates.append(date.today() + timedelta(int(arg)))
for court in Court.objects.all():
if court.id in {SUPREME_COURT, SUPREME_ADMINISTRATIVE_COURT}:
continue
for dat in dates:
Task.objects.get_or_create(court=court, date=dat)
LOGGER.info('Tasks scheduled')
示例12: cron_notify
# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import info [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')
示例13: sir_notice
# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import info [as 别名]
def sir_notice(uid):
text = ''
res = Tracked.objects.filter(uid=uid, vec__link__isnull=False).order_by('desc', 'id').distinct()
if res:
text = 'Došlo ke změně v těchto insolvenčních řízeních, která sledujete:\n\n'
for ins in res:
refresh_link(ins.vec)
text += (
' - {0}sp. zn. {1} {2.senat:d} INS {2.bc:d}/{2.rocnik:d}\n'
.format('{}, '.format(ins.desc) if ins.desc else '', L2S[ins.vec.idOsobyPuvodce], ins.vec))
text += ' {}\n\n'.format(ins.vec.link)
Tracked.objects.filter(uid=uid, vec__link__isnull=False).delete()
LOGGER.info('Non-empty notice prepared for user "{}" ({:d})'.format(User.objects.get(pk=uid).username, uid))
Insolvency.objects.filter(uid=uid).update(notify=False)
return text
示例14: cron_courtrooms
# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import info [as 别名]
def cron_courtrooms():
for court in Court.objects.exclude(id=SUPREME_ADMINISTRATIVE_COURT):
try:
sleep(1)
res = get(LIST_COURTROOMS.format(court.pk))
soup = BeautifulSoup(res.text, 'xml')
for room in soup.find_all('jednaciSin'):
croom, croomc = Courtroom.objects.get_or_create(
court=court,
desc=room.nazev.string)
if not croomc:
croom.save()
except: # pragma: no cover
LOGGER.warning('Error downloading courtrooms')
LOGGER.info('Courtrooms downloaded')
示例15: partydelall
# 需要导入模块: from legal.common.utils import LOGGER [as 别名]
# 或者: from legal.common.utils.LOGGER import info [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')