def handle(self, *args, **options): translation.activate(settings.DEFAULT_LOCALE) args = (u"%s %s" % (sys.argv[0], u"nosmsd_incoming"), ) + args nohandle(*args, DJANGO=True) translation.deactivate()
def handle(self, *args, **options): translation.activate(settings.DEFAULT_LOCALE) args = (u"%s %s" % (sys.argv[0], u"nosmsd_incoming"),) + args nohandle(*args, DJANGO=True) translation.deactivate()
def handle(*args, **options): # args format: (sender, text) if len(args) != 3: logger.error(u"Incorrect input.\nUsage: %s FROM TEXT" % args[0]) sys.exit(1) # create message object in DB try: sender, text = args[1:] sender = sender.strip() text = text.strip() msg = Inbox.add(sender, text) logger.info("Added message as ID #%d" % msg.id) # launch message handler nohandle(args[0], msg.id) except Exception as e: logger.error(u"Unable to record message:\n%r" % e) sys.exit(1)