This file contains hidden or 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
| Desired Result: | |
| <p class="whatever"> | |
| What are the minimum keypresses to get there? Function keypresses are | |
| indicated by {TAB} {ENTER} etc. | |
| <p c{TAB}whatever"> | |
| 15 key presses! |
This file contains hidden or 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
| Desired Result: | |
| <p class="whatever"></p> | |
| What are the minimum keypresses to get there? Function keypresses are | |
| indicated by {TAB} {ENTER} {SPACE} etc. | |
This file contains hidden or 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
| # Get set of users who anthony sent a message to | |
| ## Isolate the user we care about. | |
| anthony = User.query.filter_by(username='anthony').first() | |
| ## What messages were sent by that user: | |
| subq = db.session.query(ChatHistory.with_user).filter(ChatHistory.user_id==anthony.id).distinct().subquery() | |
| ## What users does that relate to? | |
| users = User.query.filter(User.id.in_(subq)).all() |
This file contains hidden or 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
| {% macro render_field(field,help=False,icon=False,counter=False,text=False) %} | |
| {% if field.type not in ('SubmitField') %} | |
| <div class="control-group{% if field.errors %} warning{% endif %}"> | |
| {% if field.type in ('EmailField','PasswordField','TextField','TextAreaField','FileField', | |
| 'QuerySelectFieldCustom','DecimalField','SelectField','BooleanField','IntegerField','DecimalField' | |
| ) %} | |
| {{ field.label(class="control-label") }} | |
| <div class="controls"> | |
| {% if icon %} |
This file contains hidden or 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
| handler = logging.StreamHandler(sys.stdout) | |
| handler.setLevel(logging.DEBUG) | |
| handler.setFormatter(logging.Formatter( | |
| '%(asctime)s %(levelname)s: %(message)s ' | |
| '[in %(pathname)s:%(lineno)d]' | |
| )) | |
| app.logger.addHandler(handler) | |
| app.logger.info('Testing Info Level') |
This file contains hidden or 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
| from flask.ext.wtf import Form, TextField, Required, TextAreaField,\ | |
| IntegerField, DecimalField, SubmitField, SelectField, HiddenField, FileField,\ | |
| QuerySelectMultipleField, widgets | |
| class ToggleWidget(object): | |
| """ | |
| Renders a list of fields as a `ul` or `ol` list. | |
| This is used for fields which encapsulate many inner fields as subfields. | |
| The widget will try to iterate the field to get access to the subfields and |
This file contains hidden or 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
| <form method="post"> | |
| {{ form.hidden_tag() }} | |
| {{ form.example }} | |
| <input type="submit"> | |
| </form> |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Title</title> | |
| </head> | |
| <body> | |
| <form method="post"> | |
| {{ form.hidden_tag() }} | |
| {{ form.example }} |
This file contains hidden or 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
| example = [(1, u'FromFlask', u'file1.ext', u"['file2.ext']", u'WCP', u'WR_HS', u'email@hotmail.com', u'nothing happens', u'2013-01-3009:15:18.628922', u'None'), (2, u'FromFlask', u'file1.ext', u"['file2.ext']", u'WCP', u'WR_HS', u'email@hotmail.com', u'nothing happens', u'2013-01-3009:15:29.963847', u'None'), (3, u'FromFlask', u'file1.ext', u"['file2.ext']", u'WCP', u'WR_HS', u'email@windriver.com', u'nothing happens', u'2013-01-3009:21:16.275987', u'None'), (4, u'Cody', u'file1.ext', u"['inp_test.ext']", u'WCA', u'WR_HS', u'email@windriver.com', u'nothing happens', u'2013-01-3009:34:03.196901', u'None')] | |
| [(x, x) for x in example] | |
| # is the same as: | |
| output = list() | |
| for x in example: | |
| output.append((x,x)) | |
This file contains hidden or 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
| <form method="post"> | |
| {{ form.hidden_tag() }} | |
| {{ form.images }} | |
| <input type="submit"> | |
| </form> |