Black formatting
This commit is contained in:
parent
d47f444ba7
commit
4e1336d1ba
3 changed files with 5 additions and 6 deletions
|
|
@ -20,7 +20,7 @@ def notify_comment(comment: Comment):
|
||||||
def publish_comment(comment: Comment):
|
def publish_comment(comment: Comment):
|
||||||
# if published before notification is received
|
# if published before notification is received
|
||||||
if comment.notified == None:
|
if comment.notified == None:
|
||||||
db()(db().comment.id == comment.id).update(notified=datetime.now())
|
db()(db().comment.id == comment.id).update(notified=datetime.now())
|
||||||
db()(db().comment.id == comment.id).update(published=datetime.now())
|
db()(db().comment.id == comment.id).update(published=datetime.now())
|
||||||
db().commit()
|
db().commit()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ def configure_and_validate_mailer(config, logger):
|
||||||
config.get(ConfigParameter.SMTP_LOGIN),
|
config.get(ConfigParameter.SMTP_LOGIN),
|
||||||
config.get(ConfigParameter.SMTP_PASSWORD),
|
config.get(ConfigParameter.SMTP_PASSWORD),
|
||||||
)
|
)
|
||||||
mailer.configure_destination(config.get(ConfigParameter.SITE_ADMIN_EMAIL))
|
mailer.configure_destination(config.get(ConfigParameter.SITE_ADMIN_EMAIL))
|
||||||
try:
|
try:
|
||||||
if not mailer.check():
|
if not mailer.check():
|
||||||
logger.error("Email configuration not working")
|
logger.error("Email configuration not working")
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import PyRSS2Gen
|
||||||
|
|
||||||
from stacosys.db import dao
|
from stacosys.db import dao
|
||||||
|
|
||||||
RFC_822_FORMAT = '%a, %d %b %Y %H:%M:%S +0000'
|
RFC_822_FORMAT = "%a, %d %b %Y %H:%M:%S +0000"
|
||||||
|
|
||||||
|
|
||||||
class Rss:
|
class Rss:
|
||||||
|
|
@ -42,7 +42,7 @@ class Rss:
|
||||||
link=item_link,
|
link=item_link,
|
||||||
description=markdownizer.convert(row.content),
|
description=markdownizer.convert(row.content),
|
||||||
guid=PyRSS2Gen.Guid(f"{item_link}{row.id}"),
|
guid=PyRSS2Gen.Guid(f"{item_link}{row.id}"),
|
||||||
pubDate=self._to_rfc822(row.published)
|
pubDate=self._to_rfc822(row.published),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -58,5 +58,4 @@ class Rss:
|
||||||
rss.write_xml(outfile, encoding="utf-8")
|
rss.write_xml(outfile, encoding="utf-8")
|
||||||
|
|
||||||
def _to_rfc822(self, dt):
|
def _to_rfc822(self, dt):
|
||||||
return dt.replace(tzinfo=timezone.utc) \
|
return dt.replace(tzinfo=timezone.utc).strftime("%a, %d %b %Y %H:%M:%S %z")
|
||||||
.strftime('%a, %d %b %Y %H:%M:%S %z')
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue