Пример #1
0
 def save_alert_settings(self):
     email_address = gui_utilities.gobject_get_value(
         self.gobjects['entry_email_address'])
     phone_number = gui_utilities.gobject_get_value(
         self.gobjects['entry_sms_phone_number'])
     sms_carrier = gui_utilities.gobject_get_value(
         self.gobjects['combobox_sms_carrier'])
     server_user = self.application.server_user
     if email_address and not utilities.is_valid_email_address(
             email_address):
         gui_utilities.show_dialog_warning(
             'Invalid Email Address', self.parent,
             'The email address you have entered is not valid.')
         return
     if phone_number:
         phone_number = ''.join(d for d in phone_number
                                if d in string.digits)
         if len(phone_number) > 11:
             gui_utilities.show_dialog_warning(
                 'Invalid Phone Number', self.parent,
                 'The phone number must not contain more than 11 digits')
             return
     email_address = utilities.nonempty_string(email_address)
     phone_number = utilities.nonempty_string(phone_number)
     sms_carrier = utilities.nonempty_string(sms_carrier)
     self.application.rpc(
         'db/table/set', 'users', server_user.id,
         ('email_address', 'phone_number', 'phone_carrier'),
         (email_address, phone_number, sms_carrier))
Пример #2
0
	def save_sms_settings(self):
		phone_number = gui_utilities.gobject_get_value(self.gobjects['entry_sms_phone_number'])
		sms_carrier = gui_utilities.gobject_get_value(self.gobjects['combobox_sms_carrier'])
		server_user = self.application.server_user
		if phone_number:
			phone_number = ''.join(d for d in phone_number if d in string.digits)
			if len(phone_number) > 11:
				gui_utilities.show_dialog_warning('Invalid Phone Number', self.parent, 'The phone number must not contain more than 11 digits')
				return
		phone_number = utilities.nonempty_string(phone_number)
		sms_carrier = utilities.nonempty_string(sms_carrier)
		self.application.rpc('db/table/set', 'users', server_user.id, ('phone_number', 'phone_carrier'), (phone_number, sms_carrier))
Пример #3
0
 def verify_sms_settings(self):
     phone_number = gui_utilities.gobject_get_value(
         self.gobjects['entry_sms_phone_number'])
     phone_number_set = bool(phone_number)
     sms_carrier_set = bool(
         self.gobjects['combobox_sms_carrier'].get_active() > 0)
     if phone_number_set ^ sms_carrier_set:
         gui_utilities.show_dialog_warning(
             'Missing Information', self.parent,
             'Both a phone number and a valid carrier must be specified')
         if 'sms_phone_number' in self.config:
             del self.config['sms_phone_number']
         if 'sms_carrier' in self.config:
             del self.config['sms_carrier']
     elif phone_number_set and sms_carrier_set:
         phone_number = ''.join(d for d in phone_number
                                if d in string.digits)
         if len(phone_number) != 10:
             gui_utilities.show_dialog_warning(
                 'Invalid Phone Number', self.parent,
                 'The phone number must contain exactly 10 digits')
             return
         username = self.config['server_username']
         self.application.rpc('db/table/set', 'users', username,
                              ('phone_number', 'phone_carrier'),
                              (phone_number, self.config['sms_carrier']))
Пример #4
0
 def verify_sms_settings(self):
     phone_number = gui_utilities.gobject_get_value(
         self.gobjects['entry_sms_phone_number'])
     phone_number_set = bool(phone_number)
     sms_carrier_set = bool(
         self.gobjects['combobox_sms_carrier'].get_active() > 0)
     if phone_number_set ^ sms_carrier_set:
         gui_utilities.show_dialog_warning(
             'Missing Information', self.parent,
             'Both a phone number and a valid carrier must be specified')
         if 'sms_phone_number' in self.config:
             del self.config['sms_phone_number']
         if 'sms_carrier' in self.config:
             del self.config['sms_carrier']
     elif phone_number_set and sms_carrier_set:
         phone_number = filter(lambda x: x in map(str, range(0, 10)),
                               phone_number)
         if len(phone_number) != 10:
             gui_utilities.show_dialog_warning(
                 'Invalid Phone Number', self.parent,
                 'The phone number must contain exactly 10 digits')
             return
         username = self.config['server_username']
         self.parent.rpc('users/set', username,
                         ('phone_number', 'phone_carrier'),
                         (phone_number, self.config['sms_carrier']))
Пример #5
0
	def save_alert_settings(self):
		email_address = gui_utilities.gobject_get_value(self.gobjects['entry_email_address'])
		phone_number = gui_utilities.gobject_get_value(self.gobjects['entry_sms_phone_number'])
		sms_carrier = gui_utilities.gobject_get_value(self.gobjects['combobox_sms_carrier'])
		server_user = self.application.server_user
		if email_address and not utilities.is_valid_email_address(email_address):
			gui_utilities.show_dialog_warning('Invalid Email Address', self.parent, 'The email address you have entered is not valid.')
			return
		if phone_number:
			phone_number = ''.join(d for d in phone_number if d in string.digits)
			if len(phone_number) > 11:
				gui_utilities.show_dialog_warning('Invalid Phone Number', self.parent, 'The phone number must not contain more than 11 digits')
				return
		email_address = utilities.nonempty_string(email_address)
		phone_number = utilities.nonempty_string(phone_number)
		sms_carrier = utilities.nonempty_string(sms_carrier)
		self.application.rpc('db/table/set', 'users', server_user.id, ('email_address', 'phone_number', 'phone_carrier'), (email_address, phone_number, sms_carrier))
Пример #6
0
	def verify_sms_settings(self):
		phone_number = gui_utilities.gobject_get_value(self.gobjects['entry_sms_phone_number'])
		phone_number_set = bool(phone_number)
		sms_carrier_set = bool(self.gobjects['combobox_sms_carrier'].get_active() > 0)
		if phone_number_set ^ sms_carrier_set:
			gui_utilities.show_dialog_warning('Missing Information', self.parent, 'Both a phone number and a valid carrier must be specified')
			if 'sms_phone_number' in self.config:
				del self.config['sms_phone_number']
			if 'sms_carrier' in self.config:
				del self.config['sms_carrier']
		elif phone_number_set and sms_carrier_set:
			phone_number = ''.join(d for d in phone_number if d in string.digits)
			if len(phone_number) != 10:
				gui_utilities.show_dialog_warning('Invalid Phone Number', self.parent, 'The phone number must contain exactly 10 digits')
				return
			username = self.config['server_username']
			self.application.rpc('users/set', username, ('phone_number', 'phone_carrier'), (phone_number, self.config['sms_carrier']))