parent
6e46eea814
commit
cfe2da56c0
3 changed files with 15 additions and 16 deletions
|
@ -28,29 +28,29 @@ def delete_comment(comment: Comment):
|
||||||
|
|
||||||
|
|
||||||
def find_not_notified_comments():
|
def find_not_notified_comments():
|
||||||
return db()(db().comment.notified is None).select()
|
return db()(db().comment.notified == None).select()
|
||||||
|
|
||||||
|
|
||||||
def find_not_published_comments():
|
def find_not_published_comments():
|
||||||
return db()(db().comment.published is None).select()
|
return db()(db().comment.published == None).select()
|
||||||
|
|
||||||
|
|
||||||
def find_published_comments_by_url(url):
|
def find_published_comments_by_url(url):
|
||||||
return db()((db().comment.url == url) & (db().comment.published is not None)).select(
|
return db()((db().comment.url == url) & (db().comment.published != None)).select(
|
||||||
orderby=db().comment.published
|
orderby=db().comment.published
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def count_published_comments(url):
|
def count_published_comments(url):
|
||||||
return (
|
return (
|
||||||
db()((db().comment.url == url) & (db().comment.published is not None)).count()
|
db()((db().comment.url == url) & (db().comment.published != None)).count()
|
||||||
if url
|
if url
|
||||||
else db()(db().comment.published is not None).count()
|
else db()(db().comment.published != None).count()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def find_recent_published_comments():
|
def find_recent_published_comments():
|
||||||
return db()(db().comment.published is not None).select(
|
return db()(db().comment.published != None).select(
|
||||||
orderby=~db().comment.published, limitby=(0, 10)
|
orderby=~db().comment.published, limitby=(0, 10)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -36,13 +36,12 @@ class Config:
|
||||||
def load(self, config_pathname):
|
def load(self, config_pathname):
|
||||||
self._cfg.read(config_pathname)
|
self._cfg.read(config_pathname)
|
||||||
|
|
||||||
@staticmethod
|
def _split_key(self, key: ConfigParameter):
|
||||||
def _split_key(key: ConfigParameter):
|
|
||||||
section, param = str(key.value).split(".")
|
section, param = str(key.value).split(".")
|
||||||
if not param:
|
if not param:
|
||||||
param = section
|
param = section
|
||||||
section = ""
|
section = ""
|
||||||
return section, param
|
return (section, param)
|
||||||
|
|
||||||
def exists(self, key: ConfigParameter):
|
def exists(self, key: ConfigParameter):
|
||||||
section, param = self._split_key(key)
|
section, param = self._split_key(key)
|
||||||
|
@ -79,8 +78,8 @@ class Config:
|
||||||
def check(self):
|
def check(self):
|
||||||
for key in ConfigParameter:
|
for key in ConfigParameter:
|
||||||
if not self.get(key):
|
if not self.get(key):
|
||||||
return False, key.value
|
return (False, key.value)
|
||||||
return True, None
|
return (True, None)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
dict_repr = {}
|
dict_repr = {}
|
||||||
|
|
|
@ -18,11 +18,11 @@ class Mailer:
|
||||||
self._site_admin_email: str = ""
|
self._site_admin_email: str = ""
|
||||||
|
|
||||||
def configure_smtp(
|
def configure_smtp(
|
||||||
self,
|
self,
|
||||||
smtp_host,
|
smtp_host,
|
||||||
smtp_port,
|
smtp_port,
|
||||||
smtp_login,
|
smtp_login,
|
||||||
smtp_password,
|
smtp_password,
|
||||||
) -> None:
|
) -> None:
|
||||||
self._smtp_host = smtp_host
|
self._smtp_host = smtp_host
|
||||||
self._smtp_port = smtp_port
|
self._smtp_port = smtp_port
|
||||||
|
|
Loading…
Add table
Reference in a new issue