Overview
| Comment: | removed lazy database connection |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | master | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
9450c03d4185b39bb4c29906d2c58b77 |
| User & Date: | c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 on 2010-08-07 16:33:08.000 |
| Other Links: | branch diff | manifest | tags |
Context
|
2010-08-07
| ||
| 16:33 | optimized some functions check-in: 16383de08e user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk | |
| 16:33 | removed lazy database connection check-in: 9450c03d41 user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk | |
|
2010-07-14
| ||
| 13:50 | * removed unneeded check on rules * added possibility to specify masks check-in: 1fa8a88371 user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk | |
Changes
Modified squid-tagger.py
from [59906f1a4b]
to [c2a10863f5].
| ︙ | ︙ | |||
21 22 23 24 25 26 27 | def notice(self, message): if self._syslog: self._syslog.syslog(self._syslog.LOG_NOTICE, message) # wrapper around database class tagDB: | | < < < < < < | | | | | | | | < > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
def notice(self, message):
if self._syslog:
self._syslog.syslog(self._syslog.LOG_NOTICE, message)
# wrapper around database
class tagDB:
__slots__ = frozenset(('_check_stmt', '_db'))
def __init__(self):
config.section('database')
self._db = postgresql.open(
'pq://{}:{}@{}/{}'.format(
config['user'],
config['password'],
config['host'],
config['database'],
) )
self._check_stmt = self._db.prepare("select redirect_url, regexp from site_rule where site <@ tripdomain($1) and netmask >> $2::text::inet order by array_length(site, 1) desc")
def check(self, site, ip_address):
return(self._check_stmt(site, ip_address))
# abstract class with basic checking functionality
class Checker:
__slots__ = frozenset(['_db', '_log'])
|
| ︙ | ︙ |