def _expand(self, path): """ we are filtering the files found by the pattern """ # get all the file's paths paths = ConfigSmasher._expand(self, path) # now filter by the pattern paths = filter(lambda p: self.pattern.match(basename(p)), paths) return paths
# the body, simple, straitforward parser.add_argument('body',help='body of email') # the rest of the args are file / dir paths parser.add_argument('attachment_paths',nargs='*', help='attach files / dirs') # parse those cmd line options! log.debug('parsing args') args = parser.parse_args() log.debug('args: %s' % args) log.debug('reading config') # read in from the configs config = ConfigSmasher(['configs']).smash() log.debug('config: %s' % config) log.debug('creating queue') # create our queue queue_config = config.get('queue') queue = KawaiiQueueClient(queue_config.get('name'), queue_config.get('host'), queue_config.get('port')) log.debug('creating mailer') # create our mailer, attached to the new queue mailer = MailerClient(queue)
log.debug('sending it off!') # send it off! mail.send() log.debug('sent!') if __name__ == '__main__': log.debug('starting') log.debug('reading config') # read in our config config = ConfigSmasher(['configs']).smash() log.debug('config: %s' % config) log.debug('creating queue') # create our queue queue_config = config.get('queue') queue = KawaiiQueueClient(queue_config.get('name'), queue_config.get('host'), queue_config.get('port')) log.debug('creating mailer') # now create our mailer smtp_config = config.get('smtp') mailer = QueueMailer(queue,
def __init__(self, to_smash=None, pattern=None): ConfigSmasher.__init__(self, to_smash) self.pattern = re.compile(pattern)