commit
bf5aed256a
|
|
@ -29,7 +29,7 @@ class Job(Base):
|
||||||
article = Column(Integer)
|
article = Column(Integer)
|
||||||
title = Column(String)
|
title = Column(String)
|
||||||
user_name = Column(Integer, ForeignKey("user.name"))
|
user_name = Column(Integer, ForeignKey("user.name"))
|
||||||
format = Column(Enum('pdf', 'mobi'))
|
format = Column(Enum('pdf', 'mobi', 'epub'))
|
||||||
|
|
||||||
|
|
||||||
class ContextSession:
|
class ContextSession:
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class Sender:
|
||||||
mobi = MIMEApplication(data)
|
mobi = MIMEApplication(data)
|
||||||
encode_base64(mobi)
|
encode_base64(mobi)
|
||||||
mobi.add_header('Content-Disposition', 'attachment',
|
mobi.add_header('Content-Disposition', 'attachment',
|
||||||
filename='article_{id}.{format}'.format(id=article, format=format))
|
filename='{title}.{format}'.format(title=title, format=format))
|
||||||
|
|
||||||
msg.attach(mobi)
|
msg.attach(mobi)
|
||||||
|
|
||||||
|
|
@ -43,7 +43,8 @@ class Sender:
|
||||||
smtp.login(self.user, self.passwd)
|
smtp.login(self.user, self.passwd)
|
||||||
smtp.sendmail(self.from_addr, [email], msg.as_string())
|
smtp.sendmail(self.from_addr, [email], msg.as_string())
|
||||||
smtp.quit()
|
smtp.quit()
|
||||||
logger.info("Mail with article {article} in format {format} sent to {email}".format(article=article,
|
logger.info("Mail with article {article} in format {format} with title {title} sent to {email}".format(article=article,
|
||||||
|
title=title,
|
||||||
format=format,
|
format=format,
|
||||||
email=email))
|
email=email))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,8 @@ Tag = namedtuple('Tag', ['tag', 'format'])
|
||||||
|
|
||||||
|
|
||||||
def make_tags(tag):
|
def make_tags(tag):
|
||||||
return (Tag(tag='{tag}'.format(tag=tag), format='mobi'),
|
return (Tag(tag='{tag}'.format(tag=tag), format='epub'),
|
||||||
|
Tag(tag='{tag}-epub'.format(tag=tag), format='epub'),
|
||||||
Tag(tag='{tag}-mobi'.format(tag=tag), format='mobi'),
|
Tag(tag='{tag}-mobi'.format(tag=tag), format='mobi'),
|
||||||
Tag(tag='{tag}-pdf'.format(tag=tag), format='pdf'))
|
Tag(tag='{tag}-pdf'.format(tag=tag), format='pdf'))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue