-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Martin Heinz
committed
Apr 15, 2019
1 parent
070ed70
commit 85add6f
Showing
7 changed files
with
10 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +0,0 @@ | ||
from flask_wtf import FlaskForm | ||
from wtforms import StringField, SubmitField | ||
from wtforms.validators import DataRequired | ||
|
||
|
||
class PublishForm(FlaskForm): | ||
topic = StringField('Topic', validators=[DataRequired()]) | ||
message = StringField('Message', validators=[DataRequired()]) | ||
submit = SubmitField('Publish') | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,8 @@ | ||
from flask import render_template, request, flash, redirect, url_for | ||
|
||
from app.app_setup import client | ||
from flask import render_template | ||
|
||
from app.web import web | ||
from app.web.forms import PublishForm | ||
|
||
|
||
@web.route('/') | ||
def index(): | ||
return render_template('index.html', title='Home') | ||
|
||
|
||
@web.route('/publish', methods=['GET', 'POST']) | ||
def publish(): | ||
form = PublishForm(request.form) | ||
error = None | ||
if request.method == 'POST': | ||
if form.validate(): | ||
client.publish(form.topic.data, form.message.data) | ||
flash('Message Send.') | ||
return redirect(url_for('web.index', _scheme="https", _external=True)) | ||
error = "Incorrect Topic or Message." | ||
return render_template('publish.html', title='Publish to Topic', form=form, error=error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters