def _subscriberFromDict(self, data): if data is None: return None subscriber = Subscriber() subscriber.rowId = data["_id"] subscriber.email = data["email"] subscriber.appId = data["appId"] subscriber.lastReviewId = data["lastReviewId"] return subscriber
def addSubscriber(args): storage = getStorage() subscriber = storage.getSubscriber(email = args.email, appId = args.appId) if subscriber is not None: return application = storage.getApplicationWithIdentifier(args.appId) if application is None: application = Application() application.identifier = args.appId storage.replaceApplication(application) subscriber = Subscriber() subscriber.email = args.email subscriber.appId = args.appId storage.insertSubscriber(subscriber)
def open_subscribe_page(): form = SubscriptionForm(request.form) if request.method == 'POST': name = request.form['name'] email = request.form['email'] subscriber = find_by_email(email) if subscriber: flash( 'Oops! Looks like you have already subscribed to mailing list', 'warning') else: subscriber = Subscriber(name=name, email=email) save(subscriber) send_welcome_email({'name': name, 'email': email}) flash('Success! You have now subscribed to the mailing list', 'success') return render_template('subscribe.html', form=form)