Changeset View
Changeset View
Standalone View
Standalone View
wallace/module_optout.py
Show All 29 Lines | |||||
from email.utils import getaddresses | from email.utils import getaddresses | ||||
import modules | import modules | ||||
import pykolab | import pykolab | ||||
from pykolab.translate import _ | from pykolab.translate import _ | ||||
log = pykolab.getLogger('pykolab.wallace') | log = pykolab.getLogger('pykolab.wallace/optout') | ||||
conf = pykolab.getConf() | conf = pykolab.getConf() | ||||
mybasepath = '/var/spool/pykolab/wallace/optout/' | mybasepath = '/var/spool/pykolab/wallace/optout/' | ||||
def __init__(): | def __init__(): | ||||
modules.register('optout', execute, description=description()) | modules.register('optout', execute, description=description()) | ||||
def description(): | def description(): | ||||
▲ Show 20 Lines • Show All 114 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)