Code Quality

pull/17/head
Yax 12 months ago
parent 31ceded4b4
commit 6e46eea814

@ -28,29 +28,29 @@ def delete_comment(comment: Comment):
def find_not_notified_comments():
return db()(db().comment.notified == None).select()
return db()(db().comment.notified is None).select()
def find_not_published_comments():
return db()(db().comment.published == None).select()
return db()(db().comment.published is None).select()
def find_published_comments_by_url(url):
return db()((db().comment.url == url) & (db().comment.published != None)).select(
return db()((db().comment.url == url) & (db().comment.published is not None)).select(
orderby=db().comment.published
)
def count_published_comments(url):
return (
db()((db().comment.url == url) & (db().comment.published != None)).count()
db()((db().comment.url == url) & (db().comment.published is not None)).count()
if url
else db()(db().comment.published != None).count()
else db()(db().comment.published is not None).count()
)
def find_recent_published_comments():
return db()(db().comment.published != None).select(
return db()(db().comment.published is not None).select(
orderby=~db().comment.published, limitby=(0, 10)
)

@ -36,12 +36,13 @@ class Config:
def load(self, config_pathname):
self._cfg.read(config_pathname)
def _split_key(self, key: ConfigParameter):
@staticmethod
def _split_key(key: ConfigParameter):
section, param = str(key.value).split(".")
if not param:
param = section
section = ""
return (section, param)
return section, param
def exists(self, key: ConfigParameter):
section, param = self._split_key(key)
@ -78,8 +79,8 @@ class Config:
def check(self):
for key in ConfigParameter:
if not self.get(key):
return (False, key.value)
return (True, None)
return False, key.value
return True, None
def __repr__(self):
dict_repr = {}

Loading…
Cancel
Save