def send_rfps_to_subscribers(self): """ As the function name implies, all subscribed users will receive an RFP update to their email accounts. By comparing an RFP's parse date to a subscription's last update date, we ensure dups aren't being sent out. Returns a list of results based on what happened for each subscription. """ results = [] subs = Subscription.all() for sub in subs: try: # Grab what user info, add first, last name later user = User.query(query.FilterNode('username', '=', sub.username)).get() # Ensure the the sub's username is associated with an actual account # by checking if the email exists. if user.email: self._send_rfps_to_subscribers(sub, user.first_name, user.email, results) else: msg = 'No email found for username: %s and keyword: %s' % (sub.username, sub.keyword) logging.info(msg) results.append('Error: ' + msg) except: msg = 'Problem with sending RFPs for some subscription, maybe bad user object' logging.info(msg) results.append('Error: ' + msg) return results
def show_register(self, err_msg="", info_msg=""): user = None username = self.get_username() subscriptions = None if username is not None: # grab all user's subscriptions subscriptions = Subscription.all().filter( 'username ='******'action': self.request.url, 'err_msg': err_msg, "user": user, "username": username, 'info_msg': info_msg, 'subscriptions' : subscriptions } self.show_rendered_html('templates/user_info_form.html', template_values)
def show_register(self, err_msg="", info_msg=""): user = None username = self.get_username() subscriptions = None if username is not None: # grab all user's subscriptions subscriptions = Subscription.all().filter('username ='******'action': self.request.url, 'err_msg': err_msg, "user": user, "username": username, 'info_msg': info_msg, 'subscriptions': subscriptions } self.show_rendered_html('templates/user_info_form.html', template_values)
def send_rfps_to_subscribers(self): """ As the function name implies, all subscribed users will receive an RFP update to their email accounts. By comparing an RFP's parse date to a subscription's last update date, we ensure dups aren't being sent out. Returns a list of results based on what happened for each subscription. """ results = [] subs = Subscription.all() for sub in subs: try: # Grab what user info, add first, last name later user = User.query( query.FilterNode('username', '=', sub.username)).get() # Ensure the the sub's username is associated with an actual account # by checking if the email exists. if user.email: self._send_rfps_to_subscribers(sub, user.first_name, user.email, results) else: msg = 'No email found for username: %s and keyword: %s' % ( sub.username, sub.keyword) logging.info(msg) results.append('Error: ' + msg) except: msg = 'Problem with sending RFPs for some subscription, maybe bad user object' logging.info(msg) results.append('Error: ' + msg) return results