def is_allowed_MCC(self, dbhandle=None): dballoc = False if dbhandle is None: import dbops db = dbops.MongoORM() dbhandle = db if not dbhandle.getMCC(self.numberdata.country_code): self.valid = False if dballoc: del db del dbhandle return self.valid
import dbops import validations from config import ReConfig instance = "0" logger = logging.getLogger('mailHandler') readdress_configs = ReConfig() support_mail = readdress_configs.ConfigSectionMap('SUPPORT')['SUPPORT_MAIL'] feedback_mail = readdress_configs.ConfigSectionMap('FEEDBACK')['FEEDBACK_MAIL'] contact_mail = readdress_configs.ConfigSectionMap('CONTACT')['CONTACT_MAIL'] supportlist = [support_mail, feedback_mail, contact_mail] #class for all db operations using mongodb db = dbops.MongoORM() #instanttiate class for common validations valids = validations.Validations() #below regex objs are for handling new thread mails taddrcomp = re.compile('([\w.-]+(#)[\w.-]+)@' + readdress_configs.get_ourdomain()) subcomp = re.compile('#') rclient = StrictRedis() ps = rclient.pubsub() ps.subscribe(['configmodified'])