--- umc/python/passwordreset/sending/send_sms.py (Revision 78343) +++ umc/python/passwordreset/sending/send_sms.py (Arbeitskopie) @@ -68,16 +68,19 @@ raise ValueError("SendSMS: UCR umc/self-service/passwordreset/sms/country_code must contain a number.") self.password_file = self.ucr.get("umc/self-service/passwordreset/sms/password_file") - try: - with open(self.password_file) as pw_file: - self.sms_username, self.sms_password = pw_file.readline().strip().split(":") - except ValueError as ve: - self.log("SendSMS: Format of sms secrets file ({}) is 'username:password'. Error: {}").format(self.password_file, ve) - self.log("SendSMS: Format error in sms secrets file ({}): {}".format(self.password_file, ve)) - raise - except (OSError, IOError) as e: - self.log("SendSMS: Error reading sms secrets file ({}): {}".format(self.password_file, e)) - raise + if self.password_file: + try: + with open(self.password_file) as pw_file: + self.sms_username, self.sms_password = pw_file.readline().strip().split(":") + except ValueError as ve: + self.log("SendSMS: Format of sms secrets file ({}) is 'username:password'. Error: {}").format(self.password_file, ve) + self.log("SendSMS: Format error in sms secrets file ({}): {}".format(self.password_file, ve)) + raise + except (OSError, IOError) as e: + self.log("SendSMS: Error reading sms secrets file ({}): {}".format(self.password_file, e)) + raise + else: + self.sms_username, self.sms_password = "", "" @staticmethod def send_method():