From: Matt Webb Date: Sun, 28 Sep 2014 07:55:23 +0000 (+0100) Subject: simple message status X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=0cc8e47b60a03a2d1103b9ea7011c0fef8911bc5;p=sirius.git simple message status --- diff --git a/app/main/__init__.py b/app/main/__init__.py index a446a3d..7e0b78f 100644 --- a/app/main/__init__.py +++ b/app/main/__init__.py @@ -7,12 +7,13 @@ from app.models.core import Device from app.core.commands import set_delivery_and_print import pprint +import cgi main = Blueprint('main', __name__) class SendDeliveryForm(Form): - html = TextAreaField(u'HTML to render') - submit = SubmitField('Send Delivery') + message = TextAreaField(u'Type a message here') + submit = SubmitField('Send') @main.route('/') def index(): @@ -27,10 +28,10 @@ def device(device_address): sender = current_app.sender if form.validate_on_submit(): - #html = """

Hello, World!

My name is Little Printer

""" + html = """

%s

""" % form.message.data flash('Form submitted') q = sender.for_device(device) if q is not None: - dc = set_delivery_and_print(device.device_address, html=form.html.data) + dc = set_delivery_and_print(device.device_address, html=html) q.queue_device_command(dc) return render_template('dump.html', dump=pprint.pformat(device), form=form)