"update nb2_latest_notifications set atime = ? where type='reply_digest'", (latestCtime, )) for email in msg_by_email: locations = [] vals = msg_by_email[email] msg = MSG_REPLY_DIGEST_HEADER % vals[0] for V in vals: if V["id_location"] not in locations: locations.append(V["id_location"]) msg += MSG_REPLY_DIGEST_BODY % V msg += MSG_REPLY_DIGEST_FOOTER if settings.DO_EMAIL: session = smtplib.SMTP(settings.SMTP_SERVER) recipients = [email] if CC_ME: recipients.append(CC_EMAIL) smtpresult = session.sendmail(settings.SMTP_USER, recipients, msg) try: print msg except UnicodeEncodeError: print "not displaying msg b/c of unicode issues" if __name__ == "__main__": ACTIONS = { "immediate": do_immediate, "digest": do_digest, "watchdog": do_watchdog } utils.process_cli(__file__, ACTIONS)
def regenerate_file(*t_args): """ (re)-generates the images for a given file """ if len(t_args)>0: args=t_args[0] if len(args)==0: print "Missing id_source" return id_source = args[0] #Add new source to the queue if not present or present and finished: o = M.Processqueue.objects.filter(source__id=id_source, completed=None) if o.count()==0: o = M.Processqueue(source_id=id_source) o.save() process_next(args) if __name__ == "__main__" : ACTIONS = { "file_img": regenerate_file, "file_update": file_update, "update_dims": update_dims, "split_chapters": split_chapters, "upload_chapters": upload_chapters, "update_rotation": update_rotation } utils.process_cli(__file__, ACTIONS)