Changeset View
Changeset View
Standalone View
Standalone View
wallace/module_optout.py
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | def execute(*args, **kw): | ||||
for stage in ['incoming', 'ACCEPT', 'REJECT', 'HOLD', 'DEFER' ]: | for stage in ['incoming', 'ACCEPT', 'REJECT', 'HOLD', 'DEFER' ]: | ||||
if not os.path.isdir(os.path.join(mybasepath, stage)): | if not os.path.isdir(os.path.join(mybasepath, stage)): | ||||
os.makedirs(os.path.join(mybasepath, stage)) | os.makedirs(os.path.join(mybasepath, stage)) | ||||
# TODO: Test for correct call. | # TODO: Test for correct call. | ||||
filepath = args[0] | filepath = args[0] | ||||
if kw.has_key('stage'): | if 'stage' in kw: | ||||
log.debug(_("Issuing callback after processing to stage %s") % (kw['stage']), level=8) | log.debug(_("Issuing callback after processing to stage %s") % (kw['stage']), level=8) | ||||
log.debug(_("Testing cb_action_%s()") % (kw['stage']), level=8) | log.debug(_("Testing cb_action_%s()") % (kw['stage']), level=8) | ||||
if hasattr(modules, 'cb_action_%s' % (kw['stage'])): | if hasattr(modules, 'cb_action_%s' % (kw['stage'])): | ||||
log.debug(_("Attempting to execute cb_action_%s()") % (kw['stage']), level=8) | log.debug(_("Attempting to execute cb_action_%s()") % (kw['stage']), level=8) | ||||
exec('modules.cb_action_%s(%r, %r)' % (kw['stage'],'optout',filepath)) | exec('modules.cb_action_%s(%r, %r)' % (kw['stage'],'optout',filepath)) | ||||
return | return | ||||
#modules.next_module('optout') | #modules.next_module('optout') | ||||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | for answer in answers: | ||||
exec('modules.cb_action_%s(%r, %r)' % (answer,'optout', filename)) | exec('modules.cb_action_%s(%r, %r)' % (answer,'optout', filename)) | ||||
os.unlink(filepath) | os.unlink(filepath) | ||||
#print "Moving filepath %s to new_filepath %s" % (filepath, new_filepath) | #print "Moving filepath %s to new_filepath %s" % (filepath, new_filepath) | ||||
#os.rename(filepath, new_filepath) | #os.rename(filepath, new_filepath) | ||||
#if hasattr(modules, 'cb_action_%s' % (optout_answer)): | #if hasattr(modules, 'cb_action_%s' % (optout_answer)): | ||||
#log.debug(_("Attempting to execute cb_action_%s()") % (optout_answer), level=8) | #log.debug(_("Attempting to execute cb_action_%s()") % (optout_answer), level=8) | ||||
Lint: PEP8 E116: unexpected indentation (comment) | |||||
#exec('modules.cb_action_%s(%r, %r)' % (optout_answer,'optout', new_filepath)) | #exec('modules.cb_action_%s(%r, %r)' % (optout_answer,'optout', new_filepath)) | ||||
Lint: PEP8 E116 unexpected indentation (comment) Lint: PEP8 E116: unexpected indentation (comment) | |||||
#return | #return | ||||
Lint: PEP8 E116 unexpected indentation (comment) Lint: PEP8 E116: unexpected indentation (comment) | |||||
def request(params=None): | def request(params=None): | ||||
params = json.dumps(params) | params = json.dumps(params) | ||||
optout_url = conf.get('wallace_optout', 'optout_url') | optout_url = conf.get('wallace_optout', 'optout_url') | ||||
try: | try: | ||||
f = urllib.urlopen(optout_url, params) | f = urllib.urlopen(optout_url, params) | ||||
Show All 13 Lines |
unexpected indentation (comment)