def handle(self, *args, **options): self.stdout.write("------------------------------\n") try: today = datetime.date.today() reminderUsers = CalUser.objects.filter(user_reminders_requested = True) count = 0 for user in reminderUsers: if email_today_reminder(user, today): count += 1 self.stdout.write(cronlog.fmt("Reminder emails sent successfully to %d users" % count)) except Exception, e: self.stderr.write(cronlog.fmt("ERROR: %s" % str(e)))
def handle(self, *args, **options): self.stdout.write("------------------------------\n") try: today = datetime.date.today() reminderUsers = CalUser.objects.filter( user_reminders_requested=True) count = 0 for user in reminderUsers: if email_today_reminder(user, today): count += 1 self.stdout.write( cronlog.fmt("Reminder emails sent successfully to %d users" % count)) except Exception, e: self.stderr.write(cronlog.fmt("ERROR: %s" % str(e)))
def handle(self, *args, **options): scrape = {'laundry':laundry, 'menus':menus, 'printers':printers} for mod_name in args: try: mod = scrape[mod_name] except KeyError: self.stderr.write(cronlog.fmt("pom.scrape.%s does not exist" % mod_name)) continue try: data = mod.scrape() except: self.stderr.write(cronlog.fmt("pom.scrape.%s failed to scrape/render" % mod_name)) continue cache.set('pom.'+mod_name, data) self.stdout.write(cronlog.fmt("pom.scrape.%s scraped/rendered successfully" % mod_name))
def handle(self, *args, **options): scrape = {'laundry': laundry, 'menus': menus, 'printers': printers} for mod_name in args: try: mod = scrape[mod_name] except KeyError: self.stderr.write( cronlog.fmt("pom.scrape.%s does not exist" % mod_name)) continue try: data = mod.scrape() except: self.stderr.write( cronlog.fmt("pom.scrape.%s failed to scrape/render" % mod_name)) continue cache.set('pom.' + mod_name, data) self.stdout.write( cronlog.fmt("pom.scrape.%s scraped/rendered successfully" % mod_name))
def handle(self, *args, **options): emails.notify_if_late() self.stdout.write(cronlog.fmt("Emails sent to users with overdue DVDs"))
def handle(self, *args, **options): emails.notify_if_late() self.stdout.write( cronlog.fmt("Emails sent to users with overdue DVDs"))
def handle(self, *args, **options): fname = os.path.join(settings.CURRENT_DIR, 'templates', 'main', '_autogen.html') f = open(fname, 'w') f.write(render_to_string('main/jquery.html')) f.close() self.stdout.write(cronlog.fmt("%s updated successfully" % fname))